{"_id":"@allnulled/ensure","name":"@allnulled/ensure","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@allnulled/ensure","version":"1.0.0","description":"Simple API to do checks and keep good error reporting. For node.js or browser.","main":"ensure.js","scripts":{"test":"node test.js"},"keywords":["check","assert","expect","test","ensure"],"author":{"name":"allnulled"},"license":"WTFPL","gitHead":"3c7994f2778b1d91c98580f93b296619dbebbf01","_id":"@allnulled/ensure@1.0.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-qJMfmIgrLO92RX5Xg5jMkiNE3UaEn23DTvZOf7bS6W3Zvp1/cI03rwnLh21fb+7oUe2FeH8KNdgoWZ3/7RAg7Q==","shasum":"f7bd8b2ad96d99574dad5b874cdfc073f80659ad","tarball":"https://registry.npmjs.org/@allnulled/ensure/-/ensure-1.0.0.tgz","fileCount":4,"unpackedSize":4977,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBK5cegtImk4T735cBF/6wYD7YIIQ913HECW4S8QqFhIAiEAmXWptP3Q+iNJj6mhyojdAL7jNsRB6MyB2aQ0XCs/y/8="}]},"_npmUser":{"name":"allnulled","email":"todosanulados@gmail.com"},"directories":{},"maintainers":[{"name":"allnulled","email":"todosanulados@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ensure_1.0.0_1734733069032_0.05285071618580295"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-20T22:17:48.966Z","1.0.0":"2024-12-20T22:17:49.212Z","modified":"2024-12-20T22:17:49.440Z"},"maintainers":[{"name":"allnulled","email":"todosanulados@gmail.com"}],"description":"Simple API to do checks and keep good error reporting. For node.js or browser.","keywords":["check","assert","expect","test","ensure"],"author":{"name":"allnulled"},"license":"WTFPL","readme":"# ensure\n\nSimple API to do checks and keep good error reporting. For node.js or browser.\n\n## Installation\n\n```sh\nnpm install -s @allnulled/ensure\n```\n\nThen on node.js:\n\n```js\nconst ensure = require(\"@allnulled/ensure\");\n```\n\nOr on browser:\n\n```html\n<script src=\"node_modules/@allnulled/ensure/ensure.js\"></script>\n```\n\nThis will overwrite the global `ensure` as a function.\n\n\n## Usage\n\nThis is all the API. With `can` you can do anything: it must return true, otherwise it will `throw` an error.\n\nThe others are variants of `can`.\n\n```js\nconst v = 500;\n\nensure({ v }).is(500);\nensure({ v }).isnt(501);\nensure({ v }).type(\"number\");\nensure({ v }).notType(\"string\");\nensure({ v }).can(n => n > 100);\nensure({ v }).cant(n => n < 100);\nensure({ v }).throws(n => { throw new Error(\"wherever\"); });\nensure({ v }).doesntThrow(n => \"ok!\");\n```","readmeFilename":"README.md"}