can-reflect
Advanced tools
Comparing version 1.14.1 to 1.14.2
{ | ||
"name": "can-reflect", | ||
"version": "1.14.1", | ||
"version": "1.14.2", | ||
"description": "reflection on unknown data types", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
@@ -25,3 +25,3 @@ var QUnit = require('steal-qunit'); | ||
}); | ||
var instance = new MyType("_id"); | ||
@@ -28,0 +28,0 @@ schema = schemaReflections.getSchema(instance); |
@@ -85,7 +85,21 @@ var canSymbol = require("can-symbol"); | ||
* ``` | ||
* | ||
* A schema for a list looks like: | ||
* | ||
* ```js | ||
* { | ||
* type: "list", | ||
* values: String | ||
* keys: { | ||
* count: Number | ||
* } | ||
* } | ||
* ``` | ||
* | ||
*/ | ||
getSchema: function(type){ | ||
var getSchema = type[getSchemaSymbol]; | ||
if(getSchema === undefined && type.constructor != null) { | ||
getSchema = type.constructor[getSchemaSymbol]; | ||
if(getSchema === undefined ) { | ||
type = type.constructor; | ||
getSchema = type && type[getSchemaSymbol]; | ||
} | ||
@@ -92,0 +106,0 @@ return getSchema.call(type); |
164907
4501