invariant.js.flow 241 Bytes
Newer Older
1 2 3 4 5 6 7 8
// @flow strict

export default function invariant(condition: mixed, message?: string): void {
  const booleanCondition = Boolean(condition);
  if (!booleanCondition) {
    throw new Error(message || 'Unexpected invariant triggered');
  }
}