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.7.2 to 0.7.3

1

lib/locale.js

@@ -5,2 +5,3 @@ 'use strict';

mixed: {
'default': '${path} is invalid',
notType: '${path} (value: `${value}`) must be a `${type}` type',

@@ -7,0 +8,0 @@ required: '${path} is a required field',

14

lib/mixed.js

@@ -237,3 +237,3 @@ 'use strict';

errorMsg = formatError(opts.message);
errorMsg = formatError(opts.message || locale['default']);

@@ -316,3 +316,4 @@ isExclusive = opts.name && next._exclusive[opts.name] === true;

var aliases = {
oneOf: ['equals']
oneOf: ['equals', 'is'],
notOneOf: ['not', 'nope']
};

@@ -332,2 +333,9 @@

});
}
}
// [{ value, exclude }]
// values.every(({ value, exclude }) => {
// var isEql = eql(value, otherval)
// return (exclude && !isEql) || isEql
// })

@@ -76,7 +76,7 @@ 'use strict';

positive: function positive(max, msg) {
positive: function positive(msg) {
return this.min(0, msg || locale.positive);
},
negative: function negative(max, msg) {
negative: function negative(msg) {
return this.max(0, msg || locale.negative);

@@ -83,0 +83,0 @@ },

@@ -22,6 +22,8 @@ 'use strict';

if (typeof options === 'function') this.fn = options;else {
if (!has(options, 'is')) throw new TypeError('.is must be provided');
if (!options.then && !options.otherwise) throw new TypeError('.then or .otherwise must be provided');
if (options.then && options.then._type !== type || options.otherwise && options.otherwise._type !== type) throw new TypeError('cannot return polymorphic conditionals');
if (!has(options, 'is')) throw new TypeError('`is:` is required for `when()` conditions');
if (!options.then && !options.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
if (options.then && options.then._type !== type || options.otherwise && options.otherwise._type !== type) throw new TypeError('cannot create polymorphic conditionals, `then` and `otherwise` must be the same type: ' + type);
is = typeof is === 'function' ? is : (function (is, value) {

@@ -28,0 +30,0 @@ return is === value;

{
"name": "yup",
"version": "0.7.2",
"version": "0.7.3",
"description": "Dead simple Object schema validation",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -5,2 +5,3 @@

mixed: {
default: '${path} is invalid',
notType: '${path} (value: `${value}`) must be a `${type}` type',

@@ -7,0 +8,0 @@ required: '${path} is a required field',

@@ -225,3 +225,3 @@ 'use strict';

errorMsg = formatError(opts.message)
errorMsg = formatError(opts.message || locale.default)

@@ -304,3 +304,4 @@ isExclusive = opts.name && next._exclusive[opts.name] === true

var aliases = {
oneOf: ['equals']
oneOf: ['equals', 'is'],
notOneOf: ['not', 'nope']
}

@@ -318,1 +319,8 @@

}
// [{ value, exclude }]
// values.every(({ value, exclude }) => {
// var isEql = eql(value, otherval)
// return (exclude && !isEql) || isEql
// })

@@ -48,7 +48,7 @@ 'use strict';

positive(max, msg) {
positive(msg) {
return this.min(0, msg || locale.positive)
},
negative(max, msg) {
negative(msg) {
return this.max(0, msg || locale.negative)

@@ -55,0 +55,0 @@ },

@@ -17,6 +17,10 @@ 'use strict';

{
if( !has(options, 'is') ) throw new TypeError('.is must be provided')
if( !options.then && !options.otherwise ) throw new TypeError('.then or .otherwise must be provided')
if( !has(options, 'is') )
throw new TypeError('`is:` is required for `when()` conditions')
if( !options.then && !options.otherwise )
throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions')
if( options.then && options.then._type !== type || options.otherwise && options.otherwise._type !== type)
throw new TypeError('cannot return polymorphic conditionals')
throw new TypeError(`cannot create polymorphic conditionals, \`then\` and \`otherwise\` must be the same type: ${type}`)

@@ -23,0 +27,0 @@ is = typeof is === 'function'

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