Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yup

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yup - npm Package Compare versions

Comparing version 0.19.0 to 0.19.1

7

CHANGELOG.md

@@ -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 @@ ---------------------------------------

28

lib/array.js

@@ -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 @@ },

11

lib/util/reach.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc