Comparing version 0.1.1 to 0.1.2
@@ -31,3 +31,3 @@ 'use strict'; | ||
__isMiniSchema__: true, | ||
__isYupSchema__: true, | ||
@@ -34,0 +34,0 @@ constructor: SchemaType, |
@@ -10,4 +10,9 @@ 'use strict'; | ||
constructor: function(){ | ||
if ( !(this instanceof _Object)) return new _Object() | ||
constructor: function(spec){ | ||
if ( !(this instanceof _Object)) | ||
return new _Object(spec) | ||
if ( spec ) | ||
return this.clone().shape(spec); | ||
this.fields = {}; | ||
@@ -17,5 +22,2 @@ SchemaObject.call(this) | ||
this._type = 'object' | ||
// if ( !_.has(this, '_default') ) | ||
// this._default = function(){ return {} } | ||
}, | ||
@@ -22,0 +24,0 @@ |
{ | ||
"name": "yup", | ||
"version": "0.1.1", | ||
"description": "Object schema validation", | ||
"version": "0.1.2", | ||
"description": "client model and persistence mechanism", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Yup | ||
======================= | ||
Javascript object schema validation. The api and style is definately inspired by/stolen from [Joi](https://github.com/hapijs/joi) which is an amazing library but generally too big and feature rich for my browser validation needs. Yup is a lean lib in the same spirit without the fancy features. You can use it on the server as well, but in that case you might as well just use Joi. | ||
a js object schema validation. The api and style is definately inspired by/stolen from [Joi](https://github.com/hapijs/joi) which is an amazing library but generally too big and feature rich for my browser validation needs. Yup is a lean lib in the same spirit without the fancy features. You can use it on the server as well, but in that case you might as well just use Joi. | ||
@@ -6,0 +6,0 @@ ## Usage |
@@ -102,2 +102,10 @@ 'use strict'; | ||
it.only('should call shape with constructed with an arg', function(){ | ||
var inst = object({ | ||
prop: mixed(), | ||
}) | ||
inst.should.have.deep.property('fields.prop') | ||
}) | ||
it('should handle empty keys', function(){ | ||
@@ -104,0 +112,0 @@ var inst = object().shape({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55903
25
1200