{"_id":"@4lolo/knockout.validation","_rev":"2-eb06b075accb37750ed6e8984d4e1090","name":"@4lolo/knockout.validation","dist-tags":{"latest":"2.0.5"},"versions":{"2.0.4":{"name":"@4lolo/knockout.validation","version":"2.0.4","description":"A KnockoutJS Plugin for model and property validation","main":"dist/knockout.validation.js","types":"dist/knockout.validation.d.ts","peerDependencies":{"knockout":">=2.3.0"},"devDependencies":{"grunt":"^1.0.4","grunt-cli":"^1.3.2","grunt-contrib-jshint":"^2.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-concat":"^1.0.1","grunt-contrib-qunit":"^3.1.0","grunt-contrib-watch":"^1.1.0","grunt-clear":"^0.2.1","jshint-stylish":"^2.2.1"},"scripts":{"test":"grunt test","build":"grunt","lint":"grunt jshint"},"repository":{"type":"git","url":"git+https://github.com/Knockout-Contrib/Knockout-Validation.git"},"author":{"name":"@ericmbarnard"},"license":"MIT","bugs":{"url":"https://github.com/Knockout-Contrib/Knockout-Validation/issues"},"homepage":"https://github.com/Knockout-Contrib/Knockout-Validation#readme","directories":{"test":"test"},"gitHead":"711f05ed2e35df5ef1e04874d3fb8c6d79a19cad","_id":"@4lolo/knockout.validation@2.0.4","_nodeVersion":"14.5.0","_npmVersion":"7.5.4","dist":{"integrity":"sha512-1WvyLrxC4rkQZCmiKuwxsRRaiQz3F8AygEg8or5ib93t2yFL6yyQbYRfHFz73adigPRUz9yhFIKS7R7itYtihQ==","shasum":"295b488c6050e777a3d739ade88d5db4796d317a","tarball":"https://registry.npmjs.org/@4lolo/knockout.validation/-/knockout.validation-2.0.4.tgz","fileCount":41,"unpackedSize":185592,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNUr9CRA9TVsSAnZWagAAHeMP/iqiQF0QqWRXyhRpFnyv\nzs+fQ/QKwo4hnA3eR/MM0h+IAFGA976MZVa7CnjhalHRRcJ1yqEJI2QrkIzE\nqIFVSc9jKRS1bFIOfHJyM4p1dxfmvwpf5ITUcL5TAMZ2P9eJkcSPkXKn3tfG\nzuk7sz+atRKB61yn4yEoKMrUs48sVqudGLStjMPCdADNyqHFUwgHuQVQ9Ie/\nsVDGVLKWZZby32ZB3KkjD1W8UIOsk+k0gsHSGdUUctlAk6FlQ+BsGOtL8Qll\nyTYVP3y820mP4moHQ+SUu5Qqy/2NbTW/ByUc4QpXQSHr61rGNq5TzgbjqxRD\nXNqmeiqC4KFkxJ71Sz5UAqbQtU4edFdzKkaPZ7NvT9dwjy5Gr+G1o3gSGh+6\nSyEcILuJD/WDUEHPJSsQvFLJOgaHqPrgfd4Dp0Y6GurXAKhT8Yvz1yMNlX6y\n4Q5sSkaYOWKb81aScqrkUeAsLiVDU1r4tEwKDiy247ShdccyJnQLBkZAxlxT\nXjCph9dWlNXOVlM0faIqO9XYzay65tu7aPswsop6SJ/o6aqYpILs/2exXZSO\nICZ9SmqyIr7JlH1/UrER+seXxJXYZEj5AxoPMkaHbEvKHdeWO6Dqxf6ZaNFr\nS7UlFqUv1wKVGgmIW5h3PN7eO/fHJfV4GckGB+BPpoj8Ap58Q0IBCDa4XyP6\nlJF4\r\n=ZKFP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDkYrVYYzwF/bUvrw0VOV9AM3ul8jMSS5h1aL8mJf880AiA3utDDTYtP5geDoYMM28qkkSxJRP9q0YDDut3jAmtptg=="}]},"_npmUser":{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/knockout.validation_2.0.4_1614105340508_0.9337577075157952"},"_hasShrinkwrap":false},"2.0.5":{"name":"@4lolo/knockout.validation","version":"2.0.5","description":"A KnockoutJS Plugin for model and property validation","main":"dist/knockout.validation.js","types":"dist/knockout.validation.d.ts","peerDependencies":{"knockout":">=2.3.0"},"devDependencies":{"grunt":"^1.0.4","grunt-cli":"^1.3.2","grunt-contrib-jshint":"^2.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-concat":"^1.0.1","grunt-contrib-qunit":"^3.1.0","grunt-contrib-watch":"^1.1.0","grunt-clear":"^0.2.1","jshint-stylish":"^2.2.1"},"scripts":{"test":"grunt test","build":"grunt","lint":"grunt jshint"},"repository":{"type":"git","url":"git+https://github.com/Knockout-Contrib/Knockout-Validation.git"},"author":{"name":"@ericmbarnard"},"license":"MIT","bugs":{"url":"https://github.com/Knockout-Contrib/Knockout-Validation/issues"},"homepage":"https://github.com/Knockout-Contrib/Knockout-Validation#readme","directories":{"test":"test"},"gitHead":"394c16fb8c175367118e351045a9364831c2486c","_id":"@4lolo/knockout.validation@2.0.5","_nodeVersion":"15.11.0","_npmVersion":"7.6.0","dist":{"integrity":"sha512-bvyitkLLtT18cVDqEarbUrz8oAxcgZBuFLt+Z/fTUB+Muz5oX6mqgJFb2EejoyWYHFUC3b5Wgqb+MjTqmN/WjA==","shasum":"7b305c809b5766b2926ff618f69060e147708dd5","tarball":"https://registry.npmjs.org/@4lolo/knockout.validation/-/knockout.validation-2.0.5.tgz","fileCount":41,"unpackedSize":185598,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhNfMTCRA9TVsSAnZWagAA3lwP/3fHEcIVFQfcoLBDRY4p\ngnxyaEtV8nMzkd7+acdr4uAxpXulX/MHW3ySoG7OUeHWQCyl81G2H17iLBwg\ne9+2uIGqiMZ5O9968MnUyKRHuX9eFp/8YgfPNulVKmsnnB1ZakmEiqBafMoA\nfI1xFFmq7x59/94YUwzqV5h/s7TcvpQ0urwmKBOtSD2LE0XCS+Yn1jb6MJap\n5zRberXyoCFXAczozxWnKHG2m3JoQUCuZrcU+fq64fAKChksX3dU6ahygGUQ\n5Y8sjyYLZTo8gp1mVFKpsN1/NtUezX2IrhUPCgJ3TZezqmr4NgFn985Cu2sT\ne+vhpVH8dXo96iiFafufoqHzJlZ8Tp+7xNzSe/idPvcx5llkHPt3/N+jVJYt\noUluFPEFnXLy2TpoMmoU+2U/dsUb6hfWp4vxMd4A2nGHZOsSytbVcqfO/sy6\noSFGdTpwFkq0XsKOp/+b4h2KngWqaSzD/C9r0ZdGIpGmLb9NLsA0c9LGSwFa\nh2lbpAv1UGhlPsVahJ5y4/QVc31/G+JSMrlY4qVhV6oGFTqZj+f/J/+lvQKZ\n9BWD8Z7sHS9mLeDBbSXNaLfbtsIDuhZlK47sioFzzBsyJftxhBfZQNcFa6KS\nB0JuYH4RxjrNu93vPvdKJR3wyA3PUoP8fcYf/xDqIdUMrclyx0ilJFUxZkJR\npan+\r\n=If8W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2GtFRZ8p6i43GE32Sx8CkD2rhWwf1ohOyTX82WHAfiQIhAKQ3w5GtYpu1BtUGEF8ldp0EkK8NUH5BdcgbnkwZaOZw"}]},"_npmUser":{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/knockout.validation_2.0.5_1630925587213_0.2003455917495771"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-23T18:35:40.461Z","2.0.4":"2021-02-23T18:35:40.646Z","modified":"2022-04-04T10:47:15.233Z","2.0.5":"2021-09-06T10:53:07.382Z"},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"description":"A KnockoutJS Plugin for model and property validation","homepage":"https://github.com/Knockout-Contrib/Knockout-Validation#readme","repository":{"type":"git","url":"git+https://github.com/Knockout-Contrib/Knockout-Validation.git"},"author":{"name":"@ericmbarnard"},"bugs":{"url":"https://github.com/Knockout-Contrib/Knockout-Validation/issues"},"license":"MIT","readme":"# Knockout Validation\r\nA KnockoutJS Plugin for model and property validation\r\n\r\n[![Build Status](https://travis-ci.org/Knockout-Contrib/Knockout-Validation.svg)](https://travis-ci.org/Knockout-Contrib/Knockout-Validation)\r\n[![Build status](https://ci.appveyor.com/api/projects/status/rmas31qgmi07wypi/branch/master?svg=true)](https://ci.appveyor.com/project/crissdev/knockout-validation/branch/master)\r\n[![Bower version](https://badge.fury.io/bo/knockout-validation.svg)](http://badge.fury.io/bo/knockout-validation)\r\n[![npm version](https://badge.fury.io/js/knockout.validation.svg)](http://badge.fury.io/js/knockout.validation)\r\n[![NuGet version](https://badge.fury.io/nu/Knockout.Validation.svg)](http://badge.fury.io/nu/Knockout.Validation)\r\n\r\nContributors:\r\n\r\n* [Eric Barnard](https://github.com/ericmbarnard)\r\n* [Steve Greatrex](https://github.com/stevegreatrex)\r\n* [Cristian Trifan](https://github.com/crissdev)\r\n* [Andy Booth](https://github.com/andybooth)\r\n* [Michal Poreba](https://github.com/michalporeba)\r\n* and many others!\r\n\r\nLicense: [MIT](http://www.opensource.org/licenses/mit-license.php)\r\n\r\n\r\n## Install\r\n\r\n#### Bower\r\n\r\n```sh\r\nbower install knockout-validation --save\r\n```\r\n\r\n#### NuGet\r\n\r\n```ps1\r\nPM> Install-Package Knockout.Validation\r\n```\r\n\r\n#### NPM\r\n\r\n```sh\r\nnpm install knockout.validation --save\r\n```\r\n\r\n#### CDN\r\n\r\n##### [cdnjs](https://cdnjs.com/libraries/knockout-validation)\r\n* https://cdnjs.cloudflare.com/ajax/libs/knockout-validation/2.0.4/knockout.validation.js\r\n* https://cdnjs.cloudflare.com/ajax/libs/knockout-validation/2.0.4/knockout.validation.min.js\r\n\r\n##### [jsdelivr](http://www.jsdelivr.com/#!knockout.validation)\r\n- https://cdn.jsdelivr.net/npm/knockout.validation@2.0.4/dist/knockout.validation.js\r\n- https://cdn.jsdelivr.net/npm/knockout.validation@2.0.4/dist/knockout.validation.min.js\r\n\r\n\r\n## Getting Started\r\n```javascript\r\n//start using it!\r\nvar myValue = ko.observable().extend({ required: true });\r\n\r\n//oooh complexity\r\nvar myComplexValue = ko.observable().extend({\r\n                     required: true,\r\n                     minLength: 3,\r\n                     pattern: {\r\n                          message: 'Hey this doesnt match my pattern',\r\n                          params: '^[A-Z0-9].$'\r\n                     }\r\n                 });\r\n\r\n//or chaining if you like that\r\nvar myComplexValue = ko.observable()\r\n\r\nmyComplexValue.extend({ required: true })\r\n            .extend({ minLength: 3 })\r\n            .extend({ pattern: {\r\n                 message: 'Hey this doesnt match my pattern',\r\n                 params: '^[A-Z0-9].$'\r\n            }});\r\n\r\n//want to know if all of your ViewModel's properties are valid?\r\nvar myViewModel = ko.validatedObservable({\r\n   property1: ko.observable().extend({ required: true }),\r\n   property2: ko.observable().extend({ max: 10 })\r\n});\r\n\r\nconsole.log(myViewModel.isValid()); //false\r\n\r\nmyViewModel().property1('something');\r\nmyViewModel().property2(9);\r\n\r\nconsole.log(myViewModel.isValid()); //true\r\n\r\n```\r\nsee more examples on the Fiddle: http://jsfiddle.net/KHFn8/5424/\r\n\r\n## Native Validation Rules\r\n**Required**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ required: true });\r\n```\r\n**Min**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ min: 2 });\r\n```\r\n**Max**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ max: 99 });\r\n```\r\n**MinLength**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ minLength: 3 });\r\n```\r\n**MaxLength**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ maxLength: 12 });\r\n```\r\n**Email**:\r\n\r\n```javascript\r\nvar myObj = ko.observable('').extend({ email: true });\r\n```\r\n\r\n... and [MANY MORE](https://github.com/Knockout-Contrib/Knockout-Validation/wiki/Native-Rules)\r\n\r\n_Much thanks to the [jQuery Validation Plug-In](https://github.com/jzaefferer/jquery-validation) team for their work on many of the rules_\r\n## Custom Validation Rules\r\n#### Custom Rules\r\nCustom Rules can be created using the simple example below. All you need is to define a validator function and a default message.\r\nThe validator function takes in the observable's value, and the `params` that you pass in with the `extend` method.\r\n\r\n```javascript\r\nko.validation.rules['mustEqual'] = {\r\n    validator: function (val, params) {\r\n        return val === params;\r\n    },\r\n    message: 'The field must equal {0}'\r\n};\r\nko.validation.registerExtenders();\r\n\r\n//the value '5' is the second arg ('params') that is passed to the validator\r\nvar myCustomObj = ko.observable().extend({ mustEqual: 5 });\r\n```\r\nLearn more about Custom Rules on the [WIKI](https://github.com/Knockout-Contrib/Knockout-Validation/wiki/Custom-Validation-Rules)\r\n\r\n**Or Check out our [User-Contributed Custom Rules](https://github.com/Knockout-Contrib/Knockout-Validation/wiki/User-Contributed-Rules)!**\r\n\r\n## HTML5 Validation Attributes\r\n\r\n**Required**:\r\n\r\n```html\r\n<input type=\"text\" data-bind=\"value: myProp\" required />\r\n```\r\n\r\n**Min**:\r\n\r\n```html\r\n<input type=\"number\" data-bind=\"value: myProp\" min=\"2\" />\r\n<input type=\"week\" data-bind=\"value:myWeek\" min=\"2012-W03\" />\r\n<input type=\"month\" data-bind=\"value:myMonth\" min=\"2012-08\" />\r\n```\r\n\r\n**Max**:\r\n\r\n```html\r\n<input type=\"number\" data-bind=\"value: myProp\" max=\"99\" />\r\n<input type=\"week\" data-bind=\"value:myWeek\" max=\"2010-W15\" />\r\n<input type=\"month\" data-bind=\"value:myMonth\" min=\"2012-08\" />\r\n```\r\n\r\n**Pattern**:\r\n\r\n```html\r\n<input type=\"text\" data-bind=\"value: myProp\" pattern=\"^[a-z0-9].*\" />\r\n```\r\n\r\n**Step**:\r\n\r\n```html\r\n<input type=\"text\" data-bind=\"value: myProp\" step=\"3\" />\r\n```\r\n**Special Note, the 'MinLength' attribute was removed until the HTML5 spec fully supports it**\r\n\r\n## Knockout Bindings\r\n\r\n### ValidationMessage\r\nIf you want to customize the display of your objects validation message, use the `validationMessage` binding:\r\n\r\n```html\r\n<div>\r\n   <input type=\"text\" data-bind=\"value: someValue\"/>\r\n   <p data-bind=\"validationMessage: someValue\"></p>\r\n<div>\r\n```\r\nCheck out more on [Validation Bindings](https://github.com/Knockout-Contrib/Knockout-Validation/wiki/Validation-Bindings)\r\n\r\n## Remote Validation Rules\r\nCheck out our [Async Validation](https://github.com/Knockout-Contrib/Knockout-Validation/wiki/Async-Rules) and [jQuery AJAX Validation](https://github.com/ericmbarnard/Knockout-Validation/wiki/Async-Rules)\r\n\r\n## Localization\r\n\r\nAdd a reference to the localization js files after the Knockout Validation plugin\r\n\r\n```html\r\n<script type=\"text/javascript\" src=\"knockout.validation.js\"></script>\r\n<script type=\"text/javascript\" src=\"el-GR.js\"></script>\r\n<script type=\"text/javascript\" src=\"fr-FR.js\"></script>\r\n<script type=\"text/javascript\" src=\"de-DE.js\"></script>\r\n```\r\n\r\nApply localized messages\r\n\r\n```js\r\nko.validation.locale('el-GR');\r\n```\r\n","readmeFilename":"README.md"}