-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stylistic fix : applied jsbeautifier with indent with 2 spaces
- Loading branch information
parhelium
committed
Aug 27, 2014
1 parent
9933540
commit 5ac398f
Showing
16 changed files
with
622 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
var Schema = require('../BaseSchema') | ||
|
||
var BooleanSchema = module.exports = Schema.extensions.BooleanSchema = new Schema.extend({ | ||
errors: function (instance) { | ||
if (!this.validate(instance)) { | ||
return this.err(instance + " is not Boolean", instance); | ||
} | ||
return false; | ||
}, | ||
validate: function (instance) { | ||
return Object(instance) instanceof Boolean | ||
}, | ||
errors: function(instance) { | ||
if (!this.validate(instance)) { | ||
return this.err(instance + " is not Boolean", instance); | ||
} | ||
return false; | ||
}, | ||
|
||
validate: function(instance) { | ||
return Object(instance) instanceof Boolean | ||
}, | ||
|
||
toJSON: function () { | ||
return { type: 'boolean' } | ||
toJSON: function() { | ||
return { | ||
type: 'boolean' | ||
} | ||
} | ||
}) | ||
|
||
var booleanSchema = module.exports = new BooleanSchema().wrap() | ||
|
||
Schema.fromJSON.def(function (sch) { | ||
if (!sch || sch.type !== 'boolean') return | ||
Schema.fromJSON.def(function(sch) { | ||
if (!sch || sch.type !== 'boolean') return | ||
|
||
return booleanSchema | ||
return booleanSchema | ||
}) | ||
|
||
Boolean.schema = booleanSchema | ||
Boolean.schema = booleanSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
var Schema = require('../BaseSchema') | ||
|
||
var ClassSchema = module.exports = Schema.patterns.ClassSchema = Schema.extend({ | ||
initialize: function (constructor) { | ||
this.constructor = constructor | ||
}, | ||
getName: function (obj) { | ||
if(!obj) return obj; | ||
if (obj instanceof Object) { | ||
return obj.constructor.name | ||
} else { | ||
return typeof obj + " = " + obj; | ||
} | ||
}, | ||
errors: function (instance) { | ||
var middleMessage = " is not instance of "; | ||
if (instance == null) { | ||
return this.err(this.getName(instance) + middleMessage + this.getName(this.constructor)) | ||
} | ||
if (!(instance instanceof this.constructor)) { | ||
return this.err(this.getName(instance) + middleMessage + this.getName(this.constructor)) | ||
} | ||
return false; | ||
}, | ||
validate: function (instance) { | ||
return instance instanceof this.constructor | ||
initialize: function(constructor) { | ||
this.constructor = constructor | ||
}, | ||
getName: function(obj) { | ||
if (!obj) return obj; | ||
if (obj instanceof Object) { | ||
return obj.constructor.name | ||
} else { | ||
return typeof obj + " = " + obj; | ||
} | ||
}, | ||
errors: function(instance) { | ||
var middleMessage = " is not instance of "; | ||
if (instance == null) { | ||
return this.err(this.getName(instance) + middleMessage + this.getName(this.constructor)) | ||
} | ||
if (!(instance instanceof this.constructor)) { | ||
return this.err(this.getName(instance) + middleMessage + this.getName(this.constructor)) | ||
} | ||
return false; | ||
}, | ||
validate: function(instance) { | ||
return instance instanceof this.constructor | ||
} | ||
}) | ||
|
||
|
||
Schema.fromJS.def(function (constructor) { | ||
if (!(constructor instanceof Function)) return | ||
Schema.fromJS.def(function(constructor) { | ||
if (!(constructor instanceof Function)) return | ||
|
||
if (constructor.schema instanceof Function) { | ||
return constructor.schema.unwrap() | ||
} else { | ||
return new ClassSchema(constructor) | ||
} | ||
}) | ||
if (constructor.schema instanceof Function) { | ||
return constructor.schema.unwrap() | ||
} else { | ||
return new ClassSchema(constructor) | ||
} | ||
}) |
Oops, something went wrong.