Comparing version 0.9.4 to 0.9.5
12
index.js
@@ -5,3 +5,3 @@ /** | ||
var util = require('underscore'); | ||
var util = require('lodash'); | ||
var sanitize = require('validator').sanitize; | ||
@@ -99,3 +99,3 @@ | ||
* otherwise throw an error | ||
* Priority: this should probably provide the default | ||
* Priority: this should probably provide the default | ||
* implementation in Waterline core. Currently it's completely | ||
@@ -123,3 +123,3 @@ * up to the adapter to define type coercion. | ||
* to declaritively define these type coercions. | ||
* Down the line, we could take this further for an even nicer API, | ||
@@ -195,3 +195,3 @@ * but for now, this alone would be a nice improvement. | ||
if ( util.isObject(name) ) { | ||
// if so all the attributes should be validation functions | ||
@@ -219,3 +219,3 @@ for (var attr in name){ | ||
} | ||
throw new Error('Definition error: \"' + name + '\" is not a valid definition.'); | ||
@@ -274,3 +274,3 @@ }; | ||
* Expose `define` so it can be used globally | ||
*/ | ||
*/ | ||
@@ -277,0 +277,0 @@ module.exports.define = Anchor.prototype.define; |
@@ -5,3 +5,3 @@ /** | ||
var _ = require('underscore'); | ||
var _ = require('lodash'); | ||
var rules = require('./rules'); | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
var _ = require('underscore'); | ||
var _ = require('lodash'); | ||
var check = require('validator').check; | ||
@@ -17,3 +17,3 @@ | ||
'empty' : function (x) { return x === ''; }, | ||
'empty' : _.isEmpty, | ||
@@ -23,3 +23,3 @@ 'required' : function (x) { | ||
// Transform data to work properly with node validator | ||
if(!x) x = ''; | ||
if(!x && x !== 0) x = ''; | ||
else if(typeof x.toString !== 'undefined') x = x.toString(); | ||
@@ -44,3 +44,8 @@ else x = '' + x; | ||
'object' : _.isObject, | ||
'json' : function (x) { return x.constructor.name === 'Object'; }, | ||
'json' : function (x) { | ||
if(_.isUndefined(x)) return false; | ||
try { JSON.stringify(x); } | ||
catch(err) { return false; } | ||
return true; | ||
}, | ||
@@ -79,3 +84,3 @@ 'string' : _.isString, | ||
'binary' : function (x) { return Buffer.isBuffer(x) || _.isString(x) }, | ||
'binary' : function (x) { return Buffer.isBuffer(x) || _.isString(x); }, | ||
@@ -82,0 +87,0 @@ 'date' : function (x) { return check(x).isDate(); }, |
{ | ||
"name": "anchor", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "Recursive validation library with support for objects and lists", | ||
@@ -20,6 +20,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"validator": "1.5.0", | ||
"underscore": "1.5.1", | ||
"validator": "~1.5.1", | ||
"lodash": "~2.0.0", | ||
"async": "0.2.9" | ||
} | ||
} |
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
36182
832
+ Addedlodash@~2.0.0
+ Addedlodash@2.0.0(transitive)
+ Addedvalidator@1.5.1(transitive)
- Removedunderscore@1.5.1
- Removedunderscore@1.5.1(transitive)
- Removedvalidator@1.5.0(transitive)
Updatedvalidator@~1.5.1