{"_id":"data.validation","_rev":"4179653","name":"data.validation","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","dist-tags":{"latest":"1.3.1"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"time":{"modified":"2026-03-01T21:45:28.000Z","created":"2013-12-25T15:44:49.304Z","1.3.1":"2016-04-08T02:24:54.298Z","1.3.0":"2014-09-21T23:41:29.799Z","1.2.0":"2014-04-12T16:05:15.601Z","1.1.1":"2014-03-21T23:56:24.347Z","1.1.0":"2014-02-27T01:53:04.916Z","1.0.0":"2013-12-25T15:44:49.304Z"},"users":{},"author":{"name":"Quildreen Motta"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.validation.git"},"versions":{"1.3.1":{"name":"data.validation","version":"1.3.1","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/folktale/data.validation.git"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","claire":"~0.4.1","ink-docstrap":"git://github.com/robotlolita/docstrap.git","jsdoc":"^3.3.0-alpha5","browserify":"^3.41.0"},"gitHead":"41ca9fcbfbd3233d0f6aba3c832abfc4315bde27","homepage":"https://github.com/folktale/data.validation#readme","_id":"data.validation@1.3.1","_shasum":"0cc3185b61a1702ad71b840117b11717eec546fa","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"robotlolita","email":"quildreen@gmail.com"},"dist":{"shasum":"0cc3185b61a1702ad71b840117b11717eec546fa","size":8954,"noattachment":false,"key":"/data.validation/-/data.validation-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.3.1.tgz"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/data.validation-1.3.1.tgz_1460082292040_0.6021572516765445"},"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:37.865Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1460082294298,"_cnpm_publish_time":1460082294298},"1.3.0":{"name":"data.validation","version":"1.3.0","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/folktale/data.validation"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","claire":"~0.4.1","ink-docstrap":"git://github.com/robotlolita/docstrap","jsdoc":"^3.3.0-alpha5","browserify":"^3.41.0"},"_id":"data.validation@1.3.0","dist":{"shasum":"87d543eb44f0511b3a1bb40f57d1705b404f9105","size":8918,"noattachment":false,"key":"/data.validation/-/data.validation-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.3.0.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:37.558Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1411342889799,"_cnpm_publish_time":1411342889799},"1.2.0":{"name":"data.validation","version":"1.2.0","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/folktale/data.validation"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{},"devDependencies":{"LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"^0.2.1","claire":"~0.4.1","ink-docstrap":"git://github.com/robotlolita/docstrap","jsdoc":"^3.3.0-alpha5","browserify":"^3.41.0"},"homepage":"https://github.com/folktale/data.validation","_id":"data.validation@1.2.0","dist":{"shasum":"e23b8be64b8ffa1a0aeabcb9fb0e3f5939c2bcd5","size":436968,"noattachment":false,"key":"/data.validation/-/data.validation-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.2.0.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:36.657Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1397318715601,"_cnpm_publish_time":1397318715601},"1.1.1":{"name":"data.validation","version":"1.1.1","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.validation"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0","claire":"~0.4.1"},"homepage":"https://github.com/folktale/data.validation","_id":"data.validation@1.1.1","dist":{"shasum":"e2bddc7f5a9b293541ae4a01651f98bee7a52f35","size":9098,"noattachment":false,"key":"/data.validation/-/data.validation-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.1.1.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:35.035Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1395446184347,"_cnpm_publish_time":1395446184347},"1.1.0":{"name":"data.validation","version":"1.1.0","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.validation"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{"claire":"~0.4.1"},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0"},"homepage":"https://github.com/folktale/data.validation","_id":"data.validation@1.1.0","dist":{"shasum":"40eadff2b774b85bdbb7b9be386d21de962db106","size":9084,"noattachment":false,"key":"/data.validation/-/data.validation-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.1.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:34.163Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1393465984916,"_cnpm_publish_time":1393465984916},"1.0.0":{"name":"data.validation","version":"1.0.0","description":"A disjunction that's more appropriate for validating inputs with better vocabulary & straight-forward failure aggregation.","main":"lib/index.js","scripts":{"test":"make test","prepublish":"make compile"},"repository":{"type":"git","url":"https://github.com/folktale/data.validation"},"keywords":["fantasy-land","folktale","algebraic","validation","disjunction","applicative","functor"],"author":{"name":"Quildreen Motta"},"license":"MIT","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"dependencies":{"claire":"~0.4.1"},"devDependencies":{"browserify":"git://github.com/robotlolita/node-browserify","groc":"git://github.com/robotlolita/groc#typography","LiveScript":"~1.2.0","hifive-tap":"~0.1.0","hifive":"~0.1.0","uglify-js":"~2.4.3","laws":"~0.2.0"},"homepage":"https://github.com/folktale/data.validation","_id":"data.validation@1.0.0","dist":{"shasum":"964a888f3c54486e226a3030a50bc5edaa9db2f5","size":66222,"noattachment":false,"key":"/data.validation/-/data.validation-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/data.validation/download/data.validation-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"killdream","email":"quildreen@gmail.com"},"maintainers":[{"name":"killdream","email":""},{"name":"robotlolita","email":""}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:31:33.286Z","deprecated":"This package is no longer supported. Consider switching to fp-ts","publish_time":1387986289304,"_cnpm_publish_time":1387986289304}},"readme":"Data.Validation\n===============\n\n[![Build Status](https://secure.travis-ci.org/folktale/data.validation.png?branch=master)](https://travis-ci.org/folktale/data.validation)\n[![NPM version](https://badge.fury.io/js/data.validation.png)](http://badge.fury.io/js/data.validation)\n[![Dependencies Status](https://david-dm.org/folktale/data.validation.png)](https://david-dm.org/folktale/data.validation)\n[![stable](http://hughsk.github.io/stability-badges/dist/stable.svg)](http://github.com/hughsk/stability-badges)\n\nThe `Validation(a, b)` is a disjunction that's more appropriate for validating\ninputs, or any use case where you want to aggregate failures. Not only the\n`Validation` provides a better terminology for working with such cases\n(`Failure` and `Success` versus `Left` and `Right`), it also allows one to\neasily aggregate failures and successes as an Applicative Functor.\n\n\n## Example\n\n```js\nvar Validation = require('data.validation')\nvar Success = Validation.Success\nvar Failure = Validation.Failure\n\n// Functions that need to do validation return one of two cases:\n//\n//  -  A Success with the value they want to propagate.\n//  -  Some value representing one or more failures, using a semigroup.\n//     Lists are the more straight-forward semigroup, so we just use them\n//     here.\nfunction isPasswordLongEnough(a) {\n  return a.length > 6?    Success(a)\n  :      /* otherwise */  Failure([\"Password must have more than 6 characters\"])\n}\n\nfunction isPasswordStrongEnough(a) {\n  return /[\\W]/.test(a)?  Success(a)\n  :      /* otherwise */  Failure([\"Password must contain special characters\"])\n}\n\n// To aggregate the failures, we start with a Success case containing\n// a curried function of arity N (where N is the number of validations),\n// and we just use an `.ap`-ply chain to get either the value our Success\n// function ultimately returns, or the aggregated failures.\nfunction isPasswordValid(a) {\n  return Success(function(x){ return function(y){ return a }})\n           .ap(isPasswordLongEnough(a))\n           .ap(isPasswordStrongEnough(a))\n}\n\n\nisPasswordValid(\"foo\")\n// => Validation.Failure([\n//      \"Password must have more than 6 characters.\",\n//      \"Password must contain special characters.\"\n//    ])\n\nisPasswordValid(\"rosesarered\")\n// => Validation.Failure([\n//      \"Password must contain special characters.\"\n//    ])\n\nisPasswordValid(\"rosesarered$andstuff\")\n// => Validation.Success(\"rosesarered$andstuff\")\n```\n\n\n## Installing\n\nThe easiest way is to grab it from NPM. If you're running in a Browser\nenvironment, you can use [Browserify][]\n\n    $ npm install data.validation\n\n\n### Using with CommonJS\n\nIf you're not using NPM, [Download the latest release][release], and require\nthe `data.validation.umd.js` file:\n\n```js\nvar Validation = require('data.validation')\n```\n\n\n### Using with AMD\n\n[Download the latest release][release], and require the `data.validation.umd.js`\nfile:\n\n```js\nrequire(['data.validation'], function(Validation) {\n  ( ... )\n})\n```\n\n\n### Using without modules\n\n[Download the latest release][release], and load the `data.validation.umd.js`\nfile. The properties are exposed in the global `folktale.data.validation` object:\n\n```html\n<script src=\"/path/to/data.validation.umd.js\"></script>\n```\n\n\n### Compiling from source\n\nIf you want to compile this library from the source, you'll need [Git][],\n[Make][], [Node.js][], and run the following commands:\n\n    $ git clone git://github.com/folktale/data.validation.git\n    $ cd data.validation\n    $ npm install\n    $ make bundle\n    \nThis will generate the `dist/data.validation.umd.js` file, which you can load in\nany JavaScript environment.\n\n    \n## Documentation\n\nYou can [read the documentation online][docs] or build it yourself:\n\n    $ git clone git://github.com/folktale/data.validation.git\n    $ cd data.validation\n    $ npm install\n    $ make documentation\n\nThen open the file `docs/index.html` in your browser.\n\n\n## Platform support\n\nThis library assumes an ES5 environment, but can be easily supported in ES3\nplatforms by the use of shims. Just include [es5-shim][] :)\n\n\n## Licence\n\nCopyright (c) 2013 Quildreen Motta.\n\nReleased under the [MIT licence](https://github.com/folktale/data.validation/blob/master/LICENCE).\n\n<!-- links -->\n[Fantasy Land]: https://github.com/fantasyland/fantasy-land\n[Browserify]: http://browserify.org/\n[Git]: http://git-scm.com/\n[Make]: http://www.gnu.org/software/make/\n[Node.js]: http://nodejs.org/\n[es5-shim]: https://github.com/kriskowal/es5-shim\n[docs]: http://folktale.github.io/data.validation\n<!-- [release: https://github.com/folktale/data.validation/releases/download/v$VERSION/data.validation-$VERSION.tar.gz] -->\n[release]: https://github.com/folktale/data.validation/releases/download/v1.3.0/data.validation-1.3.0.tar.gz\n<!-- [/release] -->\n\n","_attachments":{},"homepage":"https://github.com/folktale/data.validation#readme","bugs":{"url":"https://github.com/folktale/data.validation/issues"},"license":"MIT"}