UNPKG

313 BJavaScriptView Raw
1// @flow
2// This file is not actually executed
3// It is just used by flow for typing
4
5const prefix: string = 'Invariant failed';
6
7export default function invariant(
8 condition: mixed,
9 message?: string | (() => string),
10) {
11 if (condition) {
12 return;
13 }
14 throw new Error(`${prefix}: ${message || ''}`);
15}