{"_id":"@octetstream/invariant","_rev":"437123","name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"time":{"modified":"2021-08-05T06:19:13.000Z","created":"2017-07-28T22:11:25.991Z","1.2.0":"2018-12-18T18:38:24.042Z","1.1.0":"2017-09-24T17:26:53.124Z","1.0.3":"2017-09-19T01:03:16.475Z","1.0.2":"2017-08-24T17:45:46.412Z","1.0.1":"2017-08-12T15:04:40.307Z","1.0.0":"2017-07-28T22:11:25.991Z"},"users":{},"author":{"name":"Nick K."},"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"versions":{"1.2.0":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.2.0","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov"},"engines":{"node":"6.x || >= 8"},"dependencies":{"sprintf-js":"1.1.2"},"devDependencies":{"@octetstream/eslint-config":"3.0.0","ava":"1.0.1","codecov":"3.1.0","eslint":"5.10.0","husky":"1.2.1","nyc":"13.1.0"},"gitHead":"c8fef083d2e718ba0f785c70c078ee728bc9b479","bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"731ae22545a13093f834a6166d4c3fcf505e0abe","size":64867,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.2.0.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant_1.2.0_1545158302710_0.18523772260577465"},"_hasShrinkwrap":false,"publish_time":1545158304042,"_cnpm_publish_time":1545158304042},"1.1.0":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.1.0","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov","precommit":"yarn lint","prepush":"yarn report"},"engines":{"node":">=6"},"dependencies":{"sprintf-js":"1.1.1"},"devDependencies":{"@octetstream/eslint-config":"2.0.2","ava":"0.22.0","codecov":"2.3.0","eslint":"4.7.1","husky":"0.14.3","nyc":"11.2.1"},"gitHead":"d5b7b913ff8e314b71ecbbfc6192841036cc4ba9","bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.1.0","_npmVersion":"5.4.2","_nodeVersion":"8.5.0","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"652d73b6cb9a5f0cc6acb758843c4203d3104e84","size":38403,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.1.0.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant-1.1.0.tgz_1506274012103_0.5275045197922736"},"directories":{},"publish_time":1506274013124,"_hasShrinkwrap":false,"_cnpm_publish_time":1506274013124},"1.0.3":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.0.3","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov","precommit":"yarn lint","prepush":"yarn report"},"engines":{"node":">=6"},"dependencies":{"sprintf-js":"1.1.1"},"devDependencies":{"@octetstream/eslint-config":"2.0.2","ava":"0.22.0","codecov":"2.3.0","eslint":"4.7.1","husky":"0.14.3","nyc":"11.2.1"},"gitHead":"de82cd14e844243e2474cc92c9e7d265237992ad","bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.0.3","_npmVersion":"5.4.1","_nodeVersion":"8.5.0","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"596e91d6db49ea357dbed3d402e503b21646e8bc","size":38424,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.0.3.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant-1.0.3.tgz_1505782995436_0.4747189413756132"},"directories":{},"publish_time":1505782996475,"_hasShrinkwrap":false,"_cnpm_publish_time":1505782996475},"1.0.2":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.0.2","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov","precommit":"yarn lint","prepush":"yarn report"},"engines":{"node":">=6"},"dependencies":{"lodash.isfunction":"3.0.8","lodash.isstring":"4.0.1","sprintf-js":"1.1.1"},"devDependencies":{"@octetstream/eslint-config":"1.0.1","ava":"0.21.0","codecov":"2.2.0","eslint":"3.19.x","husky":"0.14.3","nyc":"11.0.3"},"gitHead":"cc02811e6e546ff2d67e78361d623884c1dd7713","homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.0.2","_shasum":"d45ed5f0d532cf46cee2fd10d520584678b15fe1","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"d45ed5f0d532cf46cee2fd10d520584678b15fe1","size":40646,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.0.2.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant-1.0.2.tgz_1503596744325_0.4757091295905411"},"directories":{},"publish_time":1503596746412,"_cnpm_publish_time":1503596746412,"_hasShrinkwrap":false},"1.0.1":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.0.1","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov","precommit":"yarn lint","prepush":"yarn report"},"engines":{"node":">=7.6"},"dependencies":{"lodash.isfunction":"3.0.8","lodash.isstring":"4.0.1","sprintf-js":"1.1.1"},"devDependencies":{"@octetstream/eslint-config":"1.0.1","ava":"0.21.0","codecov":"2.2.0","eslint":"3.19.x","husky":"0.14.3","nyc":"11.0.3"},"gitHead":"6e47dd5e19cfa04e9adf3ca338f725e123a157bd","homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"d5b212ae6a5e74f614a4e8047c1daa713d65235b","size":40642,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.0.1.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant-1.0.1.tgz_1502550279199_0.684335378697142"},"directories":{},"publish_time":1502550280307,"_hasShrinkwrap":false,"_cnpm_publish_time":1502550280307},"1.0.0":{"name":"@octetstream/invariant","description":"Declarative errors throwing for Node.js","version":"1.0.0","main":"invariant.js","author":{"name":"Nick K."},"license":"MIT","keywords":["invariant","test","errors"],"repository":{"type":"git","url":"git+https://github.com/octet-stream/invariant.git"},"bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"scripts":{"lint":"eslint test.js invariant.js","test":"ava test.js","codecov":"codecov","coverage":"nyc yarn test","report":"yarn coverage && node_modules/.bin/nyc report --reporter=html yarn test","report:ci":"nyc report --reporter=lcov yarn test","ci":"yarn coverage && yarn report:ci && yarn codecov","precommit":"yarn lint","prepush":"yarn report"},"engines":{"node":">=7.6"},"dependencies":{"lodash.isfunction":"3.0.8","lodash.isstring":"4.0.1","sprintf-js":"1.1.1"},"devDependencies":{"@octetstream/eslint-config":"1.0.1","ava":"0.21.0","codecov":"2.2.0","eslint":"3.19.x","husky":"0.14.3","nyc":"11.0.3"},"gitHead":"2d3fe30a084e4d84840f13cc1f7099322d88561d","homepage":"https://github.com/octet-stream/invariant#readme","_id":"@octetstream/invariant@1.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"octetstream","email":"nick.kruchinin@gmail.com"},"dist":{"shasum":"1bcc4785331f66d4bf11666d8d4e036e1780aa8d","size":40608,"noattachment":false,"key":"/@octetstream/invariant/-/@octetstream/invariant-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@octetstream/invariant/download/@octetstream/invariant-1.0.0.tgz"},"maintainers":[{"name":"octetstream","email":"nick.kruchinin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/invariant-1.0.0.tgz_1501279884626_0.3504832196049392"},"directories":{},"publish_time":1501279885991,"_hasShrinkwrap":false,"_cnpm_publish_time":1501279885991}},"readme":"# @octetstream/invariant\n\nDeclarative errors throwing for Node.js\n\n[![dependencies Status](https://david-dm.org/octet-stream/invariant/status.svg)](https://david-dm.org/octet-stream/invariant)\n[![devDependencies Status](https://david-dm.org/octet-stream/invariant/dev-status.svg)](https://david-dm.org/octet-stream/invariant?type=dev)\n[![Build Status](https://travis-ci.org/octet-stream/invariant.svg?branch=master)](https://travis-ci.org/octet-stream/invariant)\n[![Code Coverage](https://codecov.io/github/octet-stream/invariant/coverage.svg?branch=master)](https://codecov.io/github/octet-stream/invariant?branch=master)\n\n## API\n\n### `invariant(predicate, error) -> {void}`\n  - **boolean** predicate – a result of some condition. Error will threw if predicate is `true`.\n  - **object** error – some error object\n\n### `invatiant(predicate, message[, ...format]) -> {void}`\n\n  - **boolean** predicate – a result of some condition. Error will threw if predicate is `true`.\n  - **string** message – an error message\n  - **any** format – see more about the format in a [sprintf-js documentation](https://github.com/alexei/sprintf.js)\n\n### `invariant(predicate, Error, message[, ...format]) -> {void}`\n  - **boolean** predicate – a result of some condition. Error will threw if predicate is `true`.\n  - **Function** Error – custom error class that will be used as an error constructor\n  - **string** message – an error message\n  - **any** format – see more about the format in a [sprintf-js documentation](https://github.com/alexei/sprintf.js)\n\n### `invariant.reject(predicate, message[, ...format]) -> {Promise<void>}`\n\n  Do the same things as `invariant`, but returns Promise that will be rejected when predicate is true.\n  This function have same API as `invariant`.\n\n## Example\n\n```js\n  import invariant from \"@octetstream/invariant\"\n\n  // some of your code...\n\n  // Will threw a TypeError if \"value\" is not a string\n  invariant(typeof value !== \"string\", TypeError, \"The value should be a string, but given type is: %s\", typeof value)\n\n  invariant(typeof value !== \"string\", \"The value should be a string, but given type is: %s\", typeof value)\n\n  invariant(typeof value !== \"string\", new TypeError(`The value should be a string, but given type is: ${typeof value}`))\n\n  // Will return rejected Promise instead of throw error synchronously\n  invariant.reject(typeof value !== \"string\", TypeError, \"The value should be a string, but given type is: %s\", typeof value)\n    .catch(err => console.error(err))\n```\n","_attachments":{},"homepage":"https://github.com/octet-stream/invariant#readme","bugs":{"url":"https://github.com/octet-stream/invariant/issues"},"license":"MIT"}