{"_id":"ensurethat","_rev":"326744","name":"ensurethat","description":"ensurethat validates function arguments.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"time":{"modified":"2021-06-07T02:44:54.000Z","created":"2015-01-15T18:04:25.728Z","1.0.0":"2019-05-08T19:08:59.406Z","0.2.2":"2015-02-14T19:33:57.505Z","0.2.1":"2015-01-15T18:05:20.035Z","0.2.0":"2015-01-15T18:04:25.728Z"},"users":{},"repository":{"type":"git","url":"git://github.com/thenativeweb/ensurethat.git"},"versions":{"1.0.0":{"name":"ensurethat","version":"1.0.0","description":"ensurethat validates function arguments.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/ensure.js","dependencies":{"defekt":"2.0.1","humanize-string":"2.1.0"},"devDependencies":{"assertthat":"3.0.0","roboter":"4.1.0"},"repository":{"type":"git","url":"git://github.com/thenativeweb/ensurethat.git"},"keywords":["arguments","assert"],"license":"MIT","gitHead":"cfe45011102d86bcfbac52fc8b92cac23713f973","bugs":{"url":"https://github.com/thenativeweb/ensurethat/issues"},"homepage":"https://github.com/thenativeweb/ensurethat#readme","_id":"ensurethat@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"goloroden","email":"golo.roden@thenativeweb.io"},"dist":{"shasum":"9ca08fbb001a9f772e7992b1b08b690f8eb6ee59","size":2614,"noattachment":false,"key":"/ensurethat/-/ensurethat-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ensurethat/download/ensurethat-1.0.0.tgz"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ensurethat_1.0.0_1557342539237_0.28232377614344806"},"_hasShrinkwrap":false,"publish_time":1557342539406,"_cnpm_publish_time":1557342539406},"0.2.2":{"name":"ensurethat","version":"0.2.2","description":"ensurethat makes arguments handling a breeze.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/ensure.js","dependencies":{"lodash":"3.2.0","require-all":"1.0.0","verbal-expressions":"0.1.2"},"devDependencies":{"assertthat":"0.4.2","grunt":"0.4.5","tourism":"0.13.2"},"repository":{"type":"git","url":"git://github.com/thenativeweb/ensurethat.git"},"license":"MIT","gitHead":"62fd0581de4a6a78dfb15009ce0cdf9f7143be68","bugs":{"url":"https://github.com/thenativeweb/ensurethat/issues"},"homepage":"https://github.com/thenativeweb/ensurethat","_id":"ensurethat@0.2.2","scripts":{},"_shasum":"875da36b4dd4f5cfc5261dfa3dbd8409a119fbc6","_from":".","_npmVersion":"2.5.1","_nodeVersion":"1.2.0","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"875da36b4dd4f5cfc5261dfa3dbd8409a119fbc6","size":5942,"noattachment":false,"key":"/ensurethat/-/ensurethat-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ensurethat/download/ensurethat-0.2.2.tgz"},"directories":{},"publish_time":1423942437505,"_cnpm_publish_time":1423942437505,"_hasShrinkwrap":false},"0.2.1":{"name":"ensurethat","version":"0.2.1","description":"ensurethat makes arguments handling a breeze.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/ensure.js","dependencies":{"lodash":"2.4.1","require-all":"1.0.0","verbal-expressions":"0.1.2"},"devDependencies":{"assertthat":"0.3.0","grunt":"0.4.5","tourism":"0.10.2"},"repository":{"type":"git","url":"git://github.com/thenativeweb/ensurethat.git"},"license":"MIT","gitHead":"1a6b98dbce0bc462ed701d89110d71897c1b9ef9","bugs":{"url":"https://github.com/thenativeweb/ensurethat/issues"},"homepage":"https://github.com/thenativeweb/ensurethat","_id":"ensurethat@0.2.1","scripts":{},"_shasum":"73dad153691aaeede9f47dafe33d596f72d734dd","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"73dad153691aaeede9f47dafe33d596f72d734dd","size":5900,"noattachment":false,"key":"/ensurethat/-/ensurethat-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ensurethat/download/ensurethat-0.2.1.tgz"},"directories":{},"publish_time":1421345120035,"_cnpm_publish_time":1421345120035,"_hasShrinkwrap":false},"0.2.0":{"name":"ensurethat","version":"0.2.0","description":"ensurethat makes arguments handling a breeze.","contributors":[{"name":"Golo Roden","email":"golo.roden@thenativeweb.io"},{"name":"Matthias Wagler","email":"matthias.wagler@thenativeweb.io"}],"main":"lib/ensure.js","dependencies":{"lodash":"2.4.1","require-all":"1.0.0","verbal-expressions":"0.1.2"},"devDependencies":{"assertthat":"0.3.0","grunt":"0.4.5","tourism":"0.10.2"},"repository":{"type":"git","url":"git://github.com/thenativeweb/ensurethat.git"},"license":"MIT","gitHead":"c623a718c2a4ded9b8437d699044ee39565b63ad","bugs":{"url":"https://github.com/thenativeweb/ensurethat/issues"},"homepage":"https://github.com/thenativeweb/ensurethat","_id":"ensurethat@0.2.0","scripts":{},"_shasum":"4d76694b81881086bbcc2e2b060f73e45f038963","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"thenativeweb","email":"hello@thenativeweb.io"},"maintainers":[{"name":"goloroden","email":"webmaster@goloroden.de"},{"name":"nhummel","email":"hummel@marvelous.systems"},{"name":"thenativeweb-admin","email":"hello@thenativeweb.io"}],"dist":{"shasum":"4d76694b81881086bbcc2e2b060f73e45f038963","size":5902,"noattachment":false,"key":"/ensurethat/-/ensurethat-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ensurethat/download/ensurethat-0.2.0.tgz"},"directories":{},"publish_time":1421345065728,"_cnpm_publish_time":1421345065728,"_hasShrinkwrap":false}},"readme":"# ensurethat\n\nensurethat validates function arguments.\n\n## Installation\n\n```shell\n$ npm install ensurethat\n```\n\n## Quick start\n\nFirst you need to add a reference to ensurethat to your application:\n\n```javascript\nconst ensure = require('ensurethat');\n```\n\nThen you can use it to validate function arguments. A typical use case looks like the following code snippet:\n\n```javascript\nconst add = function (left, right) {\n  ensure.that({ left }).is.number();\n  ensure.that({ right }).is.number();\n\n  return left + right;\n};\n```\n\nIn case the argument passes validation, execution continues without further ado. If an argument does _not_ pass validation, an exception is thrown.\n\nDepending on the type you want to validate, use the `boolean`, `number`, `object` or `string` function. If you want to allow an argument to be optional, pass in the `isOptional` flag and set it to `true`:\n\n```javascript\nensure.that({ value }).is.number({ isOptional: true });\n```\n\n### Using advanced validators\n\nSome types provide advanced validators, i.e. you can check for more than just the type. To use advanced validators, provide them as flags in the same way as you provide `isOptional`.\n\n#### number\n\n| Validator | Description                  | Default                    |\n| --------- | ---------------------------- | -------------------------- |\n| minimum   | Specifies the minimum value. | `Number.NEGATIVE_INFINITY` |\n| maximum   | Specifies the maximum value. | `Number.POSITIVE_INFINITY` |\n\n#### object\n\n| Validator     | Description                                 | Default |\n| ------------- | ------------------------------------------- | ------- |\n| isNullAllowed | Specifies whether `null` is allowed or not. | `false` |\n\n#### string\n\n| Validator | Description                   | Default                    |\n| --------- | ----------------------------- | -------------------------- |\n| minLength | Specifies the minimum length. | `0`                        |\n| maxLength | Specifies the maximum length. | `Number.POSITIVE_INFINITY` |\n\n## Running the build\n\nTo build this module use [roboter](https://www.npmjs.com/package/roboter).\n\n```shell\n$ npx roboter\n```\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2013-2019 the native web.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/thenativeweb/ensurethat#readme","bugs":{"url":"https://github.com/thenativeweb/ensurethat/issues"},"license":"MIT"}