ts-tiny-invariant
Advanced tools
Comparing version 1.0.5 to 1.0.7
{ | ||
"name": "ts-tiny-invariant", | ||
"version": "1.0.5", | ||
"version": "1.0.7", | ||
"description": "Stricter version of tiny-invariant", | ||
@@ -56,3 +56,3 @@ "sideEffects": false, | ||
"tslint-config-standard": "^9.0.0", | ||
"typescript": "^4.4.4" | ||
"typescript": "^4.6.3" | ||
}, | ||
@@ -59,0 +59,0 @@ "jest": { |
# ts-tiny-invariant | ||
[](https://npm.im/ts-tiny-invariant) | ||
[](https://circleci.com/gh/iyegoroff/ts-tiny-invariant) | ||
[](https://github.com/iyegoroff/ts-tiny-invariant/actions/workflows/build.yml) | ||
[](https://github.com/iyegoroff/ts-tiny-invariant/actions/workflows/publish.yml) | ||
 | ||
[](https://bundlephobia.com/package/ts-tiny-invariant) | ||
[](https://bundlephobia.com/package/ts-tiny-invariant) | ||
[](https://www.npmjs.com/package/ts-tiny-invariant) | ||
<!-- [](https://bundlephobia.com/package/ts-tiny-invariant) --> | ||
Stricter version of [tiny-invariant](https://github.com/alexreardon/tiny-invariant) that accepts only `boolean` condition | ||
@@ -14,1 +17,15 @@ | ||
`$ npm i ts-tiny-invariant` | ||
## Usage | ||
```ts | ||
import invariant from 'ts-tiny-invariant' | ||
expect(() => { | ||
invariant(false, 'fail') | ||
}).toThrow('Invariant failed: fail') | ||
expect(() => { | ||
invariant(true, 'pass') | ||
}).not.toThrow() | ||
``` |
Sorry, the diff of this file is not supported yet
6393
31