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.31.0 to 0.31.1

16

CHANGELOG.md

@@ -0,1 +1,17 @@

## [0.31.1](https://github.com/jquense/yup/compare/v0.31.0...v0.31.1) (2020-12-01)
### Bug Fixes
* swallowed errors on nested schema with no tests ([5316ab9](https://github.com/jquense/yup/commit/5316ab9)), closes [#1127](https://github.com/jquense/yup/issues/1127)
### Features
* add `isTrue` and `isFalse` checks on boolean ([#910](https://github.com/jquense/yup/issues/910)) ([630a641](https://github.com/jquense/yup/commit/630a641))
# [0.31.0](https://github.com/jquense/yup/compare/v0.30.0...v0.31.0) (2020-11-23)

@@ -2,0 +18,0 @@

import inherits from './util/inherits';
import MixedSchema from './mixed';
import { boolean as locale } from './locale';
import isAbsent from './util/isAbsent';
export default BooleanSchema;

@@ -28,3 +30,37 @@

return typeof v === 'boolean';
},
isTrue: function isTrue(message) {
if (message === void 0) {
message = locale.isValue;
}
return this.test({
message: message,
name: 'is-value',
exclusive: true,
params: {
value: 'true'
},
test: function test(value) {
return isAbsent(value) || value === true;
}
});
},
isFalse: function isFalse(message) {
if (message === void 0) {
message = locale.isValue;
}
return this.test({
message: message,
name: 'is-value',
exclusive: true,
params: {
value: 'false'
},
test: function test(value) {
return isAbsent(value) || value === false;
}
});
}
});

4

es/locale.js

@@ -50,3 +50,5 @@ import _extends from "@babel/runtime/helpers/esm/extends";

};
export var boolean = {};
export var boolean = {
isValue: '${path} field must be ${value}'
};
export var object = {

@@ -53,0 +55,0 @@ noUnknown: '${path} field has unspecified keys: ${unknown}'

@@ -13,5 +13,5 @@ import ValidationError from '../ValidationError';

var count = tests.length;
if (!count) return callback(null, value);
var nestedErrors = [];
errors = errors ? errors : [];
if (!count) return errors.length ? callback(new ValidationError(errors, value, path)) : callback(null, value);

@@ -18,0 +18,0 @@ for (var i = 0; i < tests.length; i++) {

@@ -12,2 +12,6 @@ "use strict";

var _locale = require("./locale");
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
var _default = BooleanSchema;

@@ -41,4 +45,38 @@ exports.default = _default;

return typeof v === 'boolean';
},
isTrue: function isTrue(message) {
if (message === void 0) {
message = _locale.boolean.isValue;
}
return this.test({
message: message,
name: 'is-value',
exclusive: true,
params: {
value: 'true'
},
test: function test(value) {
return (0, _isAbsent.default)(value) || value === true;
}
});
},
isFalse: function isFalse(message) {
if (message === void 0) {
message = _locale.boolean.isValue;
}
return this.test({
message: message,
name: 'is-value',
exclusive: true,
params: {
value: 'false'
},
test: function test(value) {
return (0, _isAbsent.default)(value) || value === false;
}
});
}
});
module.exports = exports.default;

@@ -63,3 +63,5 @@ "use strict";

exports.date = date;
var boolean = {};
var boolean = {
isValue: '${path} field must be ${value}'
};
exports.boolean = boolean;

@@ -66,0 +68,0 @@ var object = {

@@ -22,5 +22,5 @@ "use strict";

var count = tests.length;
if (!count) return callback(null, value);
var nestedErrors = [];
errors = errors ? errors : [];
if (!count) return errors.length ? callback(new _ValidationError.default(errors, value, path)) : callback(null, value);

@@ -27,0 +27,0 @@ for (var i = 0; i < tests.length; i++) {

{
"name": "yup",
"version": "0.31.0",
"version": "0.31.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