Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
Need to qualify Schema.JSON, because minification might leave JSON un…
Browse files Browse the repository at this point in the history
…touched (which will break this check). Also, added a second parameter to Schema.registerType to specify the name, because again, Function.prototype.name will not be as expected after JS is minified.
  • Loading branch information
cha0s committed Mar 3, 2014
1 parent 02d552b commit e0180a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Schema.Text = function Text(s){ return s; };
Schema.JSON = function JSON(){};

Schema.types = {};
Schema.registerType = function (type){
this.types[type.name] = type;
Schema.registerType = function (type, name){
this.types[name || type.name] = type;
};

Schema.registerType(Schema.Text);
Schema.registerType(Schema.JSON);
Schema.registerType(Schema.Text, 'Text');
Schema.registerType(Schema.JSON, 'JSON');

/**
* Schema - adapter-specific classes factory.
Expand Down Expand Up @@ -280,7 +280,7 @@ Schema.prototype.define = function defineClass(className, properties, settings){
DataType = function Date(arg){
return new OrigDate(arg);
};
} else if (DataType.name === 'JSON' || DataType === JSON) {
} else if (DataType.name === 'JSON' || DataType === Schema.JSON) {
DataType = function JSON(s){
return s;
};
Expand Down

0 comments on commit e0180a5

Please sign in to comment.