@nuware/invariant
v1.0.2
Published
Simple invariant function
Downloads
5
Readme
invariant
Install
npm install @nuware/invariant --save
or
<script defer src="https://unpkg.com/@nuware/invariant@latest/dist/invariant.umd.js"></script>
or
<script defer src="https://unpkg.com/@nuware/invariant@latest/dist/invariant.umd.min.js"></script>
Usage
Browser
const invariant = window.nuware.invariant
Node
const {invariant} = require('@nuware/invariant')
or
import {invariant} from '@nuware/invariant'
API
import {
invariant,
raiseError
} from '@nuware/invariant'
invariant :: (*, String message) -> void
invariant(trueValue, 'if true')
invariant(falseValue, 'if false')
// => Error: Invariant: if false
raiseError :: (String message, String prefix) -> void
raiseError('some error', 'MyPrefix:')
// => Error: MyPrefix: some error
License
MIT License
Author
Dmitry Dudin [email protected]