@w5s/errorFunctionsinvariantinvariant Callableinvariant(condition, message): neverinvariant(condition, message): asserts conditionAssert that condition is truthy, else throws Error { name: 'InvariantError', message } In production environment, message parameter could be stripped from source in order to reduce file size@exampleinvariant(true, 'this should be true');// passinvariant(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