invariant
Callable
- invariant(true, 'this should be true');// passinvariant(false, 'this should be true');// throw new Error('this should be true')
invariant(true, 'this should be true');// pass
invariant(false, 'this should be true');// throw new Error('this should be true')
Assert that
conditionis truthy, else throwsError { name: 'InvariantError', message }In production environment,
messageparameter could be stripped from source in order to reduce file size