Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make getSchema return undefined when passed undefined #126

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reflections/shape/schema/schema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ QUnit.test("getSchema returns undefined when there is not schema", function(){

});

QUnit.test("getSchema returns undefined when passed undefined", function(){

QUnit.equal(schemaReflections.getSchema(undefined), undefined, "is undefined");

});

QUnit.test("canReflect.convert", function(){
var res = schemaReflections.convert("1", Number);
QUnit.equal(typeof res, "number", "is right type");
Expand Down
3 changes: 3 additions & 0 deletions reflections/shape/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ var schemaReflections = {
*
*/
getSchema: function(type){
if (type === undefined) {
return undefined;
}
var getSchema = type[getSchemaSymbol];
if(getSchema === undefined ) {
type = type.constructor;
Expand Down