Comparing version 0.19.0 to 0.19.1
@@ -0,1 +1,8 @@ | ||
v0.19.1 - Mon, 18 Jul 2016 21:53:05 GMT | ||
--------------------------------------- | ||
- [69c0ad4](../../commit/69c0ad4) [fixed] array().concat() incorrectly cleared the sub-schema | ||
v0.19.0 - Fri, 24 Jun 2016 15:19:48 GMT | ||
@@ -2,0 +9,0 @@ --------------------------------------- |
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _typeName = require('type-name'); | ||
var _typeName2 = _interopRequireDefault(_typeName); | ||
var _inherits = require('./util/inherits'); | ||
@@ -16,2 +20,6 @@ | ||
var _isSchema = require('./util/isSchema'); | ||
var _isSchema2 = _interopRequireDefault(_isSchema); | ||
var _mixed = require('./mixed'); | ||
@@ -43,3 +51,5 @@ | ||
this._subType = null; | ||
// `undefined` specifically means uninitialized, as opposed to | ||
// "no subtype" | ||
this._subType = undefined; | ||
@@ -118,5 +128,21 @@ this.withMutation(function () { | ||
}, | ||
// concat(schema) { | ||
// var next = MixedSchema.prototype.concat.call(this, schema) | ||
// | ||
// next._subType = schema._subType === undefined | ||
// ? this._subType | ||
// : schema._subType; | ||
// | ||
// return next | ||
// }, | ||
of: function of(schema) { | ||
var next = this.clone(); | ||
if (schema !== false && !(0, _isSchema2.default)(schema)) throw new TypeError('`array.of()` sub-schema must be a valid yup schema, or `false` to negate a current sub-schema. ' + 'got: ' + (0, _typeName2.default)(schema) + ' instead'); | ||
next._subType = schema; | ||
return next; | ||
@@ -123,0 +149,0 @@ }, |
@@ -26,11 +26,12 @@ 'use strict'; | ||
if (isArray || (0, _has2.default)(obj, '_subType')) { | ||
// we skipped an array | ||
// we skipped an array: foo[].bar | ||
var idx = isArray ? parseInt(part, 10) : 0; | ||
obj = obj.resolve({ context: context, parent: parent, value: value })._subType; | ||
if (value) { | ||
if (isArray && idx >= value.length) { | ||
throw new Error('Yup.reach cannot resolve an array item at index: ' + _part + ', in the path: ' + path + '. ' + 'because there is no value at that index. '); | ||
} | ||
value = value[idx]; | ||
@@ -53,3 +54,7 @@ } | ||
return obj && obj.resolve({ context: context, parent: parent, value: value }); | ||
if (obj) { | ||
obj = obj.resolve({ context: context, parent: parent, value: value }); | ||
} | ||
return obj; | ||
}; |
{ | ||
"name": "yup", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"description": "Dead simple Object schema validation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
127997
1954