revalidator
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -114,3 +114,3 @@ (function (exports) { | ||
'time': /^\d{2}:\d{2}:\d{2}$/, | ||
'color': /^#[a-z0-9]{6}|#[a-z0-9]{3}|(?:rgb\(\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*\))aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|and yellow$/i, | ||
'color': /^#[a-z0-9]{6}|#[a-z0-9]{3}|(?:rgb\(\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*\))aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow$/i, | ||
//'style': (not supported) | ||
@@ -233,3 +233,3 @@ //'phone': (not supported) | ||
if (value === undefined) { | ||
if (value === undefined || value === '') { | ||
if (schema.required && schema.type !== 'any') { | ||
@@ -300,3 +300,3 @@ return error('required', property, undefined, schema, errors); | ||
constrain('conform', value, function (a, e) { return e(a) }); | ||
constrain('conform', value, function (a, e) { return e(a, object) }); | ||
@@ -376,2 +376,3 @@ switch (type || (isArray(value) ? 'array' : typeof value)) { | ||
type === 'boolean'? typeof val === 'boolean' : | ||
type === 'date' ? isDate(val) : | ||
type === 'any' ? typeof val !== 'undefined' : false) { | ||
@@ -412,3 +413,15 @@ return callback(null, type); | ||
function isDate(value) { | ||
var s = typeof value; | ||
if (s === 'object') { | ||
if (value) { | ||
if (typeof value.getTime === 'function') { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
})(typeof(window) === 'undefined' ? module.exports : (window.json = window.json || {})); |
{ | ||
"name": "revalidator", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A cross-browser / node.js validator used by resourceful", | ||
@@ -15,3 +15,3 @@ "author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
"devDependencies": { | ||
"vows": "0.6.x" | ||
"vows": "0.7.0" | ||
}, | ||
@@ -18,0 +18,0 @@ "main": "./lib/revalidator", |
@@ -93,2 +93,3 @@ var assert = require('assert'), | ||
"with <type>:'any'": assertValidates (9, { type: "any" }), | ||
"with <type>:'date'": assertValidates (new Date(), 'hello', { type: "date" }), | ||
"with <pattern>": assertValidates ("kaboom", "42", { pattern: /^[a-z]+$/ }), | ||
@@ -235,2 +236,5 @@ "with <maxLength>": assertValidates ("boom", "kaboom", { maxLength: 4 }), | ||
return val == val.split("").reverse().join(""); } | ||
}, | ||
name: { type: 'string', default: '', conform: function(val, data) { | ||
return (val === data.author); } | ||
} | ||
@@ -255,2 +259,3 @@ }, | ||
palindrome: 'dennis sinned', | ||
name: 'cloudhead', | ||
_flag: true | ||
@@ -257,0 +262,0 @@ }, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
53016
954
2