@yozora/invariant
v2.3.16
Published
Invariant function
Downloads
36,177
Readme
An invariant function, which takes a condition and a optional message value, and throw an error
when the given condition fails.
Install
npm
npm install --save @yozora/invariant
Usage
Syntax
function invariant( condition: boolean, message?: string | (() => string), ): asserts conditionDemo
import invariant from '@yozora/invariant' invariant(typeof window !== 'undefined', '`window` is not defined.') invariant(typeof window !== 'undefined', () => '`window` is not defined:' + window)
