New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

validate.js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate.js - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

bower.json
{
"name": "validate.js",
"main": ["validate.js", "validate.min.js"],
"version": "0.1.2",
"version": "0.1.3",
"ignore": [

@@ -6,0 +6,0 @@ "**/.*",

{
"name": "validate.js",
"version": "0.1.2",
"version": "0.1.3",
"author": "Nicklas Ansman <nicklas@ansman.se>",

@@ -5,0 +5,0 @@ "description": "Declarative validations for JavaScript",

@@ -16,2 +16,3 @@ describe('validators.email', function() {

it("allows valid emails", function() {
expect(email('nicklas@ansman.se', {})).not.toBeDefined();
// Source: https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses

@@ -24,5 +25,6 @@ expect(email('niceandsimple@example.com', {})).not.toBeDefined();

expect(email('üñîçøðé@example.com', {})).not.toBeDefined();
expect(email("foo@some.customtld", {})).not.toBeDefined();
});
it("doesn't allow invalid emails", function() {
it("doesn't allow 'invalid' emails", function() {
var expected = "is not a valid email";

@@ -33,4 +35,4 @@ expect(email("foobar", {})).toEqual(expected);

// Source: https://en.wikipedia.org/wiki/Email_address#Invalid_email_addresses
expect(email('Abc.example.com', {})).toEqual(expected);
expect(email('A@b@c@example.com', {})).toEqual(expected);
expect(email('abc.example.com', {})).toEqual(expected);
expect(email('a@b@c@example.com', {})).toEqual(expected);
expect(email('a"b(c)d,e:f;g<h>i[j\\k]l@example.com', {})).toEqual(expected);

@@ -37,0 +39,0 @@ expect(email('just"not"right@example.com', {})).toEqual(expected);

@@ -1,2 +0,2 @@

// Validate.js 0.1.2
// Validate.js 0.1.3
// (c) 2013 Wrapp

@@ -384,3 +384,3 @@ // Validate.js may be freely distributed under the MIT license.

}, {
PATTERN: /^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/
PATTERN: /^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/
})

@@ -387,0 +387,0 @@ };

@@ -1,6 +0,6 @@

// validate.js 0.1.2
// validate.js 0.1.3
// http://validatejs.org/
// (c) 2013 Wrapp
// validate.js may be freely distributed under the MIT license.
(function(a,b){"use strict";var c=function(a,b,c){var e,f,g,h,i,j,k,l={};c=c||{};for(e in b){j=a[e],k=d.result(b[e],j,a,e);for(h in k){if(g=d.validators[h],!g)throw f=d.format("Unknown validator %{name}",{name:h}),new Error(f);i=k[h],i=d.result(i,j,a,e),i&&(f=g.call(g,j,i,e,a),d.isString(f)&&(f=[f]),f&&f.length>0&&(l[e]=(l[e]||[]).concat(f)))}}for(e in l)return d.fullMessages(l,c)},d=c,e=this,f=e.XDate,g=/%\{([^\}]+)\}/g;d.extend=function(a){var b,c,d,e=[].slice.call(arguments,1);for(b=0;b<e.length;++b){d=e[b];for(c in d)a[c]=d[c]}return a},d.extend(c,{result:function(a){var b=[].slice.call(arguments,1);return"function"==typeof a&&(a=a.apply(null,b)),a},isNumber:function(a){return"number"==typeof a&&!isNaN(a)},isInteger:function(a){return d.isNumber(a)&&0===a%1},isObject:function(a){return a===Object(a)},isDefined:function(a){return null!==a&&void 0!==a},format:function(a,b){return a.replace(g,function(a,c){return String(b[c])})},prettify:function(a){return a.replace(/[_\-]/g," ").replace(/([a-z])([A-Z])/g,function(a,b,c){return""+b+" "+c.toLowerCase()}).toLowerCase()},isString:function(a){return"string"==typeof a},isArray:function(a){return"[object Array]"==={}.toString.call(a)},contains:function(a,b){var c;if(!d.isDefined(a))return!1;if(d.isArray(a)){if(a.indexOf(b))return-1!==a.indexOf(b);for(c=a.length-1;c>=0;--c)if(a[c]===b)return!0;return!1}return b in a},capitalize:function(a){return a?a[0].toUpperCase()+a.slice(1):a},fullMessages:function(a,b){b=b||{};var c,e,f,g=b.flatten?[]:{};if(!a)return g;for(c in a)for(e=0;e<a[c].length;++e)f=a[c][e],"^"===f[0]?f=f.slice(1):b.fullMessages!==!1&&(f=d.format("%{attr} %{message}",{attr:d.capitalize(d.prettify(c)),message:f})),f=f.replace(/\\\^/g,"^"),b.flatten?g.push(f):(g[c]||(g[c]=[])).push(f);return g}}),c.validators={presence:function(a,b){var c,e=b.message||"can't be blank";if(!d.isDefined(a))return e;if("string"==typeof a){if(/^\s*$/.test(a))return e}else if(d.isArray(a)){if(0===a.length)return e}else if(d.isObject(a)){for(c in a)return;return e}},length:function(a,b){if(d.isDefined(a)){var c,e=b.is,f=b.maximum,g=b.minimum,h=b.tokenizer||function(a){return a},i=[];return a=h(a),d.isNumber(e)&&a.length!==e&&(c=b.wrongLength||"is the wrong length (should be %{count} characters)",i.push(d.format(c,{count:e}))),d.isNumber(g)&&a.length<g&&(c=b.tooShort||"is too short (minimum is %{count} characters)",i.push(d.format(c,{count:g}))),d.isNumber(f)&&a.length>f&&(c=b.tooLong||"is too long (maximum is %{count} characters)",i.push(d.format(c,{count:f}))),i.length>0?b.message||i:void 0}},numericality:function(a,b){if(d.isDefined(a)){var c,e,f=[],g={greaterThan:function(a,b){return a>b},greaterThanOrEqualTo:function(a,b){return a>=b},equalTo:function(a,b){return a===b},lessThan:function(a,b){return b>a},lessThanOrEqualTo:function(a,b){return b>=a}};if(b.noStrings!==!0&&d.isString(a)&&(a=+a),!d.isNumber(a))return b.message||"is not a number";if(b.onlyInteger&&!d.isInteger(a))return b.message||"must be an integer";for(c in g)e=b[c],d.isNumber(e)&&!g[c](a,e)&&f.push(d.format("must be %{type} %{count}",{count:e,type:d.prettify(c)}));return b.odd&&1!==a%2&&f.push("must be odd"),b.even&&0!==a%2&&f.push("must be even"),f.length?b.message||f:void 0}},datetime:d.extend(function(a,b){if(d.isDefined(a)){var c,e=[],f=b.message,g=b.earliest?this.parse(b.earliest,b):0/0,h=b.latest?this.parse(b.latest,b):0/0;return a=this.parse(a,b),isNaN(a)||b.dateOnly&&0!==a%864e5?f||"must be a valid date":(!isNaN(g)&&g>a&&(c="must be no earlier than %{date}",c=d.format(c,{date:this.format(g,b)}),e.push(c)),!isNaN(h)&&a>h&&(c="must be no later than %{date}",c=d.format(c,{date:this.format(h,b)}),e.push(c)),e.length?b.message||e:void 0)}},{parse:function(a){return new f(a,!0).getTime()},format:function(a,b){var c=b.dateFormat||(b.dateOnly?"yyyy-MM-dd":"u");return new f(a,!0).toString(c)}}),date:function(a,b){return b=d.extend({},b,{onlyDate:!0}),d.validators.datetime(a,b)},format:function(a,b){(d.isString(b)||b instanceof RegExp)&&(b={pattern:b});var c,e=b.message||"is invalid",f=b.pattern;if(d.isDefined(a))return d.isString(a)?(d.isString(f)&&(f=new RegExp(b.pattern,b.flags)),c=f.exec(a),c&&c[0].length==a.length?void 0:e):e},inclusion:function(a,b){if(d.isArray(b)&&(b={within:b}),d.isDefined(a)&&!d.contains(b.within,a)){var c=b.message||"^%{value} is not included in the list";return d.format(c,{value:a})}},exclusion:function(a,b){if(d.isArray(b)&&(b={within:b}),d.isDefined(a)&&d.contains(b.within,a)){var c=b.message||"^%{value} is restricted";return d.format(c,{value:a})}},email:d.extend(function(a,b){var c=b.message||"is not a valid email";if(d.isDefined(a))return d.isString(a)?this.PATTERN.exec(a)?void 0:c:c},{PATTERN:/^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/})},a?(b&&b.exports&&(a=b.exports=c),a.validate=c):e.validate=c}).call(this,"undefined"!=typeof exports?exports:null,"undefined"!=typeof module?module:null);
(function(a,b){"use strict";var c=function(a,b,c){var e,f,g,h,i,j,k,l={};c=c||{};for(e in b){j=a[e],k=d.result(b[e],j,a,e);for(h in k){if(g=d.validators[h],!g)throw f=d.format("Unknown validator %{name}",{name:h}),new Error(f);i=k[h],i=d.result(i,j,a,e),i&&(f=g.call(g,j,i,e,a),d.isString(f)&&(f=[f]),f&&f.length>0&&(l[e]=(l[e]||[]).concat(f)))}}for(e in l)return d.fullMessages(l,c)},d=c,e=this,f=e.XDate,g=/%\{([^\}]+)\}/g;d.extend=function(a){var b,c,d,e=[].slice.call(arguments,1);for(b=0;b<e.length;++b){d=e[b];for(c in d)a[c]=d[c]}return a},d.extend(c,{result:function(a){var b=[].slice.call(arguments,1);return"function"==typeof a&&(a=a.apply(null,b)),a},isNumber:function(a){return"number"==typeof a&&!isNaN(a)},isInteger:function(a){return d.isNumber(a)&&0===a%1},isObject:function(a){return a===Object(a)},isDefined:function(a){return null!==a&&void 0!==a},format:function(a,b){return a.replace(g,function(a,c){return String(b[c])})},prettify:function(a){return a.replace(/[_\-]/g," ").replace(/([a-z])([A-Z])/g,function(a,b,c){return""+b+" "+c.toLowerCase()}).toLowerCase()},isString:function(a){return"string"==typeof a},isArray:function(a){return"[object Array]"==={}.toString.call(a)},contains:function(a,b){var c;if(!d.isDefined(a))return!1;if(d.isArray(a)){if(a.indexOf(b))return-1!==a.indexOf(b);for(c=a.length-1;c>=0;--c)if(a[c]===b)return!0;return!1}return b in a},capitalize:function(a){return a?a[0].toUpperCase()+a.slice(1):a},fullMessages:function(a,b){b=b||{};var c,e,f,g=b.flatten?[]:{};if(!a)return g;for(c in a)for(e=0;e<a[c].length;++e)f=a[c][e],"^"===f[0]?f=f.slice(1):b.fullMessages!==!1&&(f=d.format("%{attr} %{message}",{attr:d.capitalize(d.prettify(c)),message:f})),f=f.replace(/\\\^/g,"^"),b.flatten?g.push(f):(g[c]||(g[c]=[])).push(f);return g}}),c.validators={presence:function(a,b){var c,e=b.message||"can't be blank";if(!d.isDefined(a))return e;if("string"==typeof a){if(/^\s*$/.test(a))return e}else if(d.isArray(a)){if(0===a.length)return e}else if(d.isObject(a)){for(c in a)return;return e}},length:function(a,b){if(d.isDefined(a)){var c,e=b.is,f=b.maximum,g=b.minimum,h=b.tokenizer||function(a){return a},i=[];return a=h(a),d.isNumber(e)&&a.length!==e&&(c=b.wrongLength||"is the wrong length (should be %{count} characters)",i.push(d.format(c,{count:e}))),d.isNumber(g)&&a.length<g&&(c=b.tooShort||"is too short (minimum is %{count} characters)",i.push(d.format(c,{count:g}))),d.isNumber(f)&&a.length>f&&(c=b.tooLong||"is too long (maximum is %{count} characters)",i.push(d.format(c,{count:f}))),i.length>0?b.message||i:void 0}},numericality:function(a,b){if(d.isDefined(a)){var c,e,f=[],g={greaterThan:function(a,b){return a>b},greaterThanOrEqualTo:function(a,b){return a>=b},equalTo:function(a,b){return a===b},lessThan:function(a,b){return b>a},lessThanOrEqualTo:function(a,b){return b>=a}};if(b.noStrings!==!0&&d.isString(a)&&(a=+a),!d.isNumber(a))return b.message||"is not a number";if(b.onlyInteger&&!d.isInteger(a))return b.message||"must be an integer";for(c in g)e=b[c],d.isNumber(e)&&!g[c](a,e)&&f.push(d.format("must be %{type} %{count}",{count:e,type:d.prettify(c)}));return b.odd&&1!==a%2&&f.push("must be odd"),b.even&&0!==a%2&&f.push("must be even"),f.length?b.message||f:void 0}},datetime:d.extend(function(a,b){if(d.isDefined(a)){var c,e=[],f=b.message,g=b.earliest?this.parse(b.earliest,b):0/0,h=b.latest?this.parse(b.latest,b):0/0;return a=this.parse(a,b),isNaN(a)||b.dateOnly&&0!==a%864e5?f||"must be a valid date":(!isNaN(g)&&g>a&&(c="must be no earlier than %{date}",c=d.format(c,{date:this.format(g,b)}),e.push(c)),!isNaN(h)&&a>h&&(c="must be no later than %{date}",c=d.format(c,{date:this.format(h,b)}),e.push(c)),e.length?b.message||e:void 0)}},{parse:function(a){return new f(a,!0).getTime()},format:function(a,b){var c=b.dateFormat||(b.dateOnly?"yyyy-MM-dd":"u");return new f(a,!0).toString(c)}}),date:function(a,b){return b=d.extend({},b,{onlyDate:!0}),d.validators.datetime(a,b)},format:function(a,b){(d.isString(b)||b instanceof RegExp)&&(b={pattern:b});var c,e=b.message||"is invalid",f=b.pattern;if(d.isDefined(a))return d.isString(a)?(d.isString(f)&&(f=new RegExp(b.pattern,b.flags)),c=f.exec(a),c&&c[0].length==a.length?void 0:e):e},inclusion:function(a,b){if(d.isArray(b)&&(b={within:b}),d.isDefined(a)&&!d.contains(b.within,a)){var c=b.message||"^%{value} is not included in the list";return d.format(c,{value:a})}},exclusion:function(a,b){if(d.isArray(b)&&(b={within:b}),d.isDefined(a)&&d.contains(b.within,a)){var c=b.message||"^%{value} is restricted";return d.format(c,{value:a})}},email:d.extend(function(a,b){var c=b.message||"is not a valid email";if(d.isDefined(a))return d.isString(a)?this.PATTERN.exec(a)?void 0:c:c},{PATTERN:/^[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9\u007F-\uffff!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}$/})},a?(b&&b.exports&&(a=b.exports=c),a.validate=c):e.validate=c}).call(this,"undefined"!=typeof exports?exports:null,"undefined"!=typeof module?module:null);
//# sourceMappingURL=validate.min.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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