Socket
Socket
Sign inDemoInstall

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.10.0 to 0.10.1

3

lib/boolean.js

@@ -14,3 +14,4 @@ 'use strict';

if (this.isType(value)) return value;
return /true|1/i.test(value);
return (/true|1/i.test(value)
);
});

@@ -17,0 +18,0 @@ }

@@ -28,4 +28,3 @@ 'use strict';

_typeCheck: function _typeCheck(v) {
return typeof v === 'number' && !(v !== +v) //isNaN check
;
return typeof v === 'number' && !(v !== +v); //isNaN check
},

@@ -32,0 +31,0 @@

@@ -6,5 +6,5 @@ 'use strict';

var MixedSchema = require('./mixed');
var Promise = require('promise/lib/es6-extensions')
var Promise = require('promise/lib/es6-extensions');
//, Reference = require('./util/Reference')
;var cloneDeep = require('./util/clone');
var cloneDeep = require('./util/clone');
var toposort = require('toposort');

@@ -180,10 +180,14 @@ var locale = require('./locale.js').object;

return this.transform(function (obj) {
var newObj = obj;
if (obj == null) return obj;
var newObj = transform(obj, function (o, val, key) {
return key !== _from && (o[key] = val);
}, {});
if (has(obj, _from)) {
newObj = transform(obj, function (o, val, key) {
return key !== _from && (o[key] = val);
}, {});
newObj[to] = obj[_from];
newObj[to] = obj[_from];
if (alias) newObj[_from] = obj[_from];
if (alias) newObj[_from] = obj[_from];
}

@@ -190,0 +194,0 @@ return newObj;

@@ -27,3 +27,3 @@ /**

// allow arbitrary sub-second precision beyond milliseconds
struct[7] = struct[7] ? +(struct[7] + '00').substr(0, 3) : 0;
struct[7] = struct[7] ? +(struct[7] + "00").substr(0, 3) : 0;

@@ -30,0 +30,0 @@ // timestamps without timezone identifiers should be considered local time

@@ -65,9 +65,9 @@ 'use strict';

if (this.inner.length) return this.inner.reduce(function (list, e) {
list[e.path] = (list[e.path] || (list[e.path] = [])).concat({ errors: e.errors, path: e.path, type: e.type });
list[e.path] = (list[e.path] || (list[e.path] = [])).concat(e.toJSON());
return list;
}, {});
if (this.path) return (_ref = {}, _ref[this.path] = err.errors, _ref);
if (this.path) return _ref = {}, _ref[this.path] = { errors: this.errors, path: this.path, type: this.type }, _ref;
return err.errors;
};
{
"name": "yup",
"version": "0.10.0",
"version": "0.10.1",
"description": "Dead simple Object schema validation",

@@ -28,3 +28,3 @@ "main": "lib/index.js",

"chai-as-promised": "^4.1.1",
"karma": "^0.12.2",
"karma": "^0.13.14",
"karma-chrome-launcher": "^0.2.0",

@@ -36,3 +36,3 @@ "karma-jsdom-launcher": "^1.0.0",

"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.6.0",
"karma-webpack": "^1.7.0",
"mocha": "^1.21.4",

@@ -44,3 +44,3 @@ "node-libs-browser": "^0.5.2",

"sinon-chai": "^2.5.0",
"webpack": "^1.10.1"
"webpack": "^1.12.2"
},

@@ -47,0 +47,0 @@ "dependencies": {

@@ -181,9 +181,13 @@ 'use strict';

return this.transform( obj => {
if ( obj == null)
var newObj = obj;
if (obj == null)
return obj
var newObj = transform(obj, (o, val, key) => key !== from && (o[key] = val), {})
if (has(obj, from)) {
newObj = transform(obj, (o, val, key) => key !== from && (o[key] = val), {})
newObj[to] = obj[from]
newObj[to] = obj[from]
if(alias) newObj[from] = obj[from]
if(alias) newObj[from] = obj[from]
}

@@ -252,2 +256,2 @@ return newObj

return toposort.array(nodes, edges).reverse()
}
}

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

return this.inner.reduce((list, e) => {
list[e.path] = (list[e.path] || (list[e.path] = [])).concat({ errors: e.errors, path: e.path, type: e.type })
list[e.path] = (list[e.path] || (list[e.path] = [])).concat(e.toJSON())
return list

@@ -62,5 +62,5 @@ }, {})

if (this.path)
return { [this.path]: err.errors }
return { [this.path]: { errors: this.errors, path: this.path, type: this.type } }
return err.errors
}

@@ -294,2 +294,15 @@ 'use strict';

it('should not move keys when it does not exist', function(){
var inst = object().shape({
myProp: mixed(),
})
.from('prop', 'myProp')
inst.cast({ myProp: 5 })
.should.eql({ myProp: 5 })
inst.cast({ myProp: 5, prop: 7 })
.should.eql({ myProp: 7 })
})
it('should handle conditionals', function(){

@@ -419,2 +432,2 @@ var inst = object().shape({

})
})
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