{"_id":"laravel-validator-for-js","_rev":"39-ae2425f5d66f0740e718006898c8e68b","name":"laravel-validator-for-js","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel 3 Validator class.","dist-tags":{"latest":"0.5.1"},"versions":{"0.2.0":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.2.0","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["A port of the Validator class in the Laravel PHP MVC framework to JavaScript"],"devDependencies":{"grunt":"~0.3.12"},"engines":{"node":">= 0.6.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":" "},"license":"BSD","readme":"##validator.js\n### Setup\n\n##### Browser usage:\n1. Include __validator.js__ or __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n\nSee SpecRunner.html for Jasmine tests and examples","_id":"laravel-validator-for-js@0.2.0","dist":{"shasum":"3efe8c0e43d68ed4f793c27a7e5ea6aecc04d2dd","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.2.0.tgz","integrity":"sha512-V+60dhvI7SoUXNFAW16ftNAakUxKlHpwAGW8kZIJ+okVS8zqsmvWsiKNlh4ab6WJdp2tMx5cRI712AmgwPcB+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKwxjmE8VCOtMmTH4SUEx/5/kwsKnkGOoNVw9afwvFUgIhANiK+8/B98s8YEgpLUqIwgR2zbI55ZH/cH1AUbrMzJtA"}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.2.1":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.2.1","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["A port of the Validator class in the Laravel PHP MVC framework to JavaScript"],"devDependencies":{"grunt":"0.4.0rc7","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"##Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n### Setup\n\n##### Browser usage:\n1. Include __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n###Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.2.1","dist":{"shasum":"b212fc932e9795e7ce6982e8bffc6b26d72027f2","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.2.1.tgz","integrity":"sha512-1TvYrsdpD3RSinAR7Iqt2zTyDZ1n7VshP1E563aVzCMhI01cQKBzyMI6EVWIruRqksbfEMYtq2nfNU5evVU+5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDN22mbtLivCCDYy2MqvyLrxNfuRBcTkglwvfzTy90TEQIgWy1gb/qbsT9L0j6d2FiGubgIhya3bac/aEEIgDQXOq4="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.3.0":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.3.0","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["A port of the Validator class in the Laravel PHP MVC framework to JavaScript"],"devDependencies":{"grunt":"0.4.0rc7","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"##Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n### Setup\n\n##### Browser usage:\n1. Include __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n###Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n###Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.3.0","dist":{"shasum":"300aea930c2287acd2686a39b53ed8d223549676","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.3.0.tgz","integrity":"sha512-oDQqGB2PB6lMHUfxp6HEM5pgnoGwLw5KRq5dqebEo+sJU36iaucOEkycNPeaPuAYTUenRA61X+kfOWArRORCDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHvQxOkIeVCJoPbmLBuhoCcfD4ZGZTSWQBUCUp2Jd+wDAiEA3vRmqcj0bOtj+6FA/twPcd6bbET3HlE57/RVwgMJjro="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.3.1":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.3.1","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["A port of the Validator class in the Laravel PHP MVC framework to JavaScript"],"devDependencies":{"grunt":"0.4.0rc7","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"##Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n### Setup\n\n##### Browser usage:\n1. Include __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n###Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n###Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.3.1","dist":{"shasum":"978f89bc419567cacd7b651d0fe13baf060fa192","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.3.1.tgz","integrity":"sha512-po5iWhyTcu1xBd/1rZe20eOw8oaqOjBrBhKZHRIERCdWlqAGEHWZ3tR7z3Rpr2NgaqYnZsiipUz9+2JyrgLpJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH93ZGQwLiSCwzclqNNiXc6re4POoEWAVCyb6FJIN4wxAiA2dOJaiA9sxgV0no1BoFH9XbB7a5Qu9MIU+oejF/gamw=="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.3.2":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.3.2","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["data validation, validator, validate, validation, data, laravel"],"devDependencies":{"grunt":"0.4.0rc7","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"##Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n### Setup\n\n##### Browser usage:\n1. Include __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n###Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n###Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.3.2","dist":{"shasum":"3b204a0b8603f2585c77f9caf07b949febd43762","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.3.2.tgz","integrity":"sha512-FN586prjvYitkoefXaabT8elHKX8VJvNvNByxF7hilYgRQ14UsCTgq79cbJg3DdrCasPhkh3s7T6lfpQgVLJEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZs3uuF4Dg3bz67MUD5mc2Vj+bGUVNcnNwDmBMY1DghAiAKx/1Y17sEHkprMx9l3rnZLFxoQK0Um95SLGQhEvhfYg=="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.3.3":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel Validator class.","version":"0.3.3","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["data validation, validator, validate, validation, data, laravel"],"devDependencies":{"grunt":"0.4.0rc7","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"##Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n### Setup\n\n##### Browser usage:\n1. Include __validator.min.js__ script onto your page from the distribution folder _dist_.\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n###Error Messages\nThis contructor will automatically generate error messages for validation rules that failed. You can use the __first__ method to fetch the first error message of a failing attribute. You can access all of the errors through the __errors__ property on the Validator instance. \n\nThere is also an __errorCount__ property on the validation instance to specify the number of validation errors.\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n###Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n###Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.3.3","dist":{"shasum":"003ac91bbb9f3e94e1ad04e6810d553f2a89b88f","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.3.3.tgz","integrity":"sha512-IuBjYDrJFm8pHGBi9T7zt9B5+WjW3JI8JW1eyhv0GSXwC1jijbO8Ld5G/ZQBYIIQRzMVJAdsc7fGcG24xKIf8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5NuIV5oUVcnLrvgxFfTeJD0U9LOe5A7QYahmEjZ7OqQIhAOOVbLVdNpOFNfQdjyqnT1PowEzTJjtFDgDuNvAQwK7H"}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.4.0":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel 3 Validator class.","version":"0.4.0","homepage":"https://github.com/skaterdav85/Validator.js","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/Validator.js"},"bugs":{"url":""},"keywords":["data validation, validator, validate, validation, data, laravel, laravel 3"],"devDependencies":{"grunt":"0.4.1","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"# Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n## Setup\n\n#### Browser:\n1. Include __validator.min.js__ script onto your page from the distribution folder _dist_.\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n#### Node.js:\nInstall the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n```js\n\tvar Validator = require('laravel-validator-for-js');\n```\n\n__Since version 0.4, the Validator constructor is immediately returned from the require call. I.e. You no longer have to do require('laravel-validator-for-js').Validator__\n\n## Usage and Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#### Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#### Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n## Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n## Error Messages\nThis contructor will automatically generate error messages for validation rules that failed. You can use the __first__ method to fetch the first error message of a failing attribute. You can access all of the errors through the __errors__ property on the Validator instance. \n\nThere is also an __errorCount__ property on the validation instance to specify the number of validation errors.\n\n## Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n## Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n## Testing\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.4.0","dist":{"shasum":"daab2972967da373c32e3e85c23455f4ff4d879c","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.4.0.tgz","integrity":"sha512-tGVMLR53QfipdwrQZ2e6lToEYGEtB0eoEgP1r0Tf+C8rB1kLTa4rVhtONsvySixyMK1TB8c/YcoXUxRopFRgIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/M431aQu+rouaaiSrgXeJh2y+Essf1TTajv4/tqx0sAIhALfvtICOLWEG+hSEe+RwjUg/cBkO7IkqwSlQ3BsNc46B"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.5.0":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel 3 Validator class.","version":"0.5.0","homepage":"https://github.com/skaterdav85/validatorjs","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/validatorjs"},"bugs":{"url":""},"keywords":["validatorjs, data validation, validator, validate, validation, data, laravel, laravel 3"],"devDependencies":{"grunt":"0.4.1","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"# Validator.js\n\n[![Build Status](https://travis-ci.org/skaterdav85/Validator.js.png?branch=master)](https://travis-ci.org/skaterdav85/Validator.js)\n\n## Setup\n\n#### Browser:\n1. Include __validator.min.js__ script onto your page from the distribution folder _dist_.\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n#### Node.js:\nInstall the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n```js\n\tvar Validator = require('laravel-validator-for-js');\n```\n\n__Since version 0.4, the Validator constructor is immediately returned from the require call. I.e. You no longer have to do require('laravel-validator-for-js').Validator__\n\n## Usage and Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#### Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#### Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n## Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n## Error Messages\nThis contructor will automatically generate error messages for validation rules that failed. You can use the __first__ method to fetch the first error message of a failing attribute. You can access all of the errors through the __errors__ property on the Validator instance. \n\nThere is also an __errorCount__ property on the validation instance to specify the number of validation errors.\n\n## Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n## Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n## Testing\n\nInstall node module dependencies\n\n```\n\tnpm install\n```\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.5.0","dist":{"shasum":"59d8386fb05aae8f8e4cf44a9e2793a7f11b09f5","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.5.0.tgz","integrity":"sha512-/yEfn7ov7EKIApEJhraSvVlxZVrjMY3meb9yePg5ORzOVF3IGDJnm8s25PPzXukI8nWSEuAn12jIbntjq4wWgw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE3nFR8OfdhgyGEP++Je02eShd7YwEbl1E/uTWaIeNOJAiEAt74/Z42jijy0G05Go2AoUh3/nYFVKYh+lfB968otZmU="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{}},"0.5.1":{"name":"laravel-validator-for-js","buildname":"validator","title":"Validator constructor function for easy data validation on both the client and server side.","description":"A constructor function for data validation on both the server and client, inspired by the Laravel PHP framework. The API is very similar to that of the Laravel 3 Validator class.","version":"0.5.1","homepage":"https://github.com/skaterdav85/validatorjs","author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/validatorjs"},"bugs":{"url":""},"keywords":["validatorjs, data validation, validator, validate, validation, data, laravel, laravel 3"],"devDependencies":{"grunt":"0.4.1","grunt-contrib-jshint":"~0.1.1","grunt-contrib-uglify":"~0.1.1"},"engines":{"node":">= 0.8.0"},"gitHead":"301ebbe9afe949a4233606d3a5f16e14be5c820e","readmeFilename":"README.md","main":"dist/validator.js","scripts":{"test":"jasmine-node spec/ --verbose --color"},"readme":"# validatorjs\n\n[![Build Status](https://travis-ci.org/skaterdav85/validatorjs.png?branch=master)](https://travis-ci.org/skaterdav85/validatorjs)\n\n## Setup\n\n#### Browser:\n1. Include __validator.min.js__ script onto your page from the distribution folder _dist_.\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n#### Node.js:\nInstall the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n```js\n\tvar Validator = require('laravel-validator-for-js');\n```\n\n__Since version 0.4, the Validator constructor is immediately returned from the require call. I.e. You no longer have to do require('laravel-validator-for-js').Validator__\n\n## Usage and Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#### Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#### Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n## Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n* url - Validate that an attribute is a URL\n\n```\n\tlink: 'url'\n```\n\n## Error Messages\nThis contructor will automatically generate error messages for validation rules that failed. You can use the __first__ method to fetch the first error message of a failing attribute. You can access all of the errors through the __errors__ property on the Validator instance. \n\nThere is also an __errorCount__ property on the validation instance to specify the number of validation errors.\n\n## Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n## Static Methods\n\n* register(custom_rule_name, callbackFn, errorMessage) - register a custom validation rule. \n\nIf __callbackFn__ returns a truthy value, the validation will pass for this rule. Otherwise, this validation rule will fail. __errorMessage__ is an optional string where you can specify a custom error message. _:attribute_ inside errorMessage will be replaced with the attribute name.\n\n```js\n\tValidator.register('telephone', function(val) {\n\t\treturn val.match(/^\\d{3}-\\d{3}-\\d{4}$/);\n\t}, 'The :attribute phone number is not in the format XXX-XXX-XXXX.');\n```\n\n## Testing\n\nInstall node module dependencies\n\n```\n\tnpm install\n```\n\nSee __SpecRunner.html__ for Jasmine tests in the browser. \n\nYou can also run the jasmine tests via Node.js once you've installed the NPM package jasmine-node.\n\n```\n\tjasmine-node spec/ --verbose --color\n\n\t//OR\n\n\tnpm test (which calls the above command)\n```\n\nOnce the above test passes, run the following command which will in turn run JSHint and minify the source\n```\n\tgrunt\n```","_id":"laravel-validator-for-js@0.5.1","dist":{"shasum":"79a1ba6e0eea6fb675866c2e48430f550e924204","tarball":"https://registry.npmjs.org/laravel-validator-for-js/-/laravel-validator-for-js-0.5.1.tgz","integrity":"sha512-w4CssVja4D3hxDx6aZ2A/YZnjjlDXHdW/TrcHQFGWY+dB1W2GKG6h2gzsTeOy0YhZCcHtuFi0qncC7ImvJYcEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLGGWCfd5BE06fYm9KppOHE8JQaJajAB6HK8ycpOHeoQIgZFBbxi8c3p8xYFnxkT5fkTVUm4w53sP/BxF4J5S23Q8="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"skaterdav85","email":"dtang85@gmail.com"},"maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"directories":{},"deprecated":"moved to validatorjs - https://npmjs.org/package/validatorjs"}},"readme":"##validator.js\n### Setup\n\n##### Browser usage:\n1. Include __validator.js__ or __validator.min.js__ script onto your page from the distribution folder (_dist_).\n2. Invoke the Validator constructor function. See below for details on Validator parameters and validation rules.\n\n##### Node.js Usage:\n* Install the Validator package from the NPM registry [https://npmjs.org/package/laravel-validator-for-js](https://npmjs.org/package/laravel-validator-for-js)\n\n```\n\tnpm install laravel-validator-for-js\n```\n\n* On your node.js script, require the module.\n\n```js\n\tvar ValidationModule = require('laravel-validator-for-js');\n\n\tvar validation = new ValidationModule.Validator({\n\t\tname: 'John',\n\t\tage: 45,\n\t\temail: 'johndoe.gmail.com'\n\t}, {\n\t\tname: 'required',\n\t\tage: 'numeric',\n\t\temail: 'required|email'\n\t});\n```\n\n* Invoke the Validator constructor function.\n\n### Examples\n\nThe __1st argument__ to the constructor is an object that contains the data you want to validate. \n\nThe __2nd argument__ is an object that contains the validation rules. \n\n#####Example 1:\n```js\n\tvar data = {\n\t\temail: 'johndoe@gmail.com'\n\t};\n\t\n\tvar rules = {\n\t\temail: 'email'\n\t};\n\n\tvar validation = new Validator(data, rules);\n\t\n\tvalidation.passes() // true\n\tvalidation.fails() // false\n\t\n```\n\nTo apply validation rules to the _input_ object, use the same object key names for the _rules_ object.\n\n#####Example 2:\n```js\n\tvar rules = {\n\t\tname: 'required|size:3',\n\t\temail: 'required|email'\n\t};\n\n\tvar data = {\n\t\tname: '',\n\t\temail: ''\n\t};\n\n\tvar validation = new Validator(data, rules);\n\n\tvalidation.fails(); // true\n\n```\n\n###Validation Rules\n\n* required - Checks if the length of the String representation of the value is > 0\n\n```\n\tusername: 'required'\n```\n\n* email - Checks for an @ symbol followed by a period\n\n\n```\n\taddress: 'email'\n```\n\n* size - Validate that an attribute is a given length, or, if an attribute is numeric, is a given value\n\n\n```\n\tduration: 'size:2'\n```\n\n* min - Validate that an attribute is at least a given size.\n\n```\n\tpayment: 'min:10'\n\t\n```\n\n* max - Validate that an attribute is no greater than a given size\n\n```\n\tcost: 'max:100'\n```\n\n* numeric - Validate that an attribute is numeric. The string representation of a number will pass.\n\n```\n\tage: 'numeric'\n```\n\n__Note: All minimum and maximum checks are inclusive.__\n\n###Public Instance Methods\n\n* passes() - returns boolean\n* fails() - returns boolean\n* first(attribute_name) - returns first error message for _string_ attribute_name, or _null_ if no error message exists\n\n\nSee SpecRunner.html for Jasmine tests and examples","maintainers":[{"name":"skaterdav85","email":"dtang85@gmail.com"}],"time":{"modified":"2022-06-19T10:41:49.772Z","created":"2013-02-06T06:22:13.416Z","0.2.0":"2013-02-06T06:22:14.148Z","0.2.1":"2013-02-27T02:47:47.509Z","0.3.0":"2013-02-28T03:56:40.344Z","0.3.1":"2013-03-01T09:43:13.601Z","0.3.2":"2013-03-11T21:25:37.873Z","0.3.3":"2013-03-13T22:14:07.044Z","0.4.0":"2013-03-17T07:10:46.479Z","0.5.0":"2013-05-23T21:13:10.704Z","0.5.1":"2013-05-23T21:23:35.423Z"},"author":{"name":"David","email":"dtang85@gmail.com"},"repository":{"type":"git","url":"https://github.com/skaterdav85/validatorjs"},"users":{"jackvial":true}}