|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
306 bytes
|
| Line | |
|---|
| 1 | // @flow
|
|---|
| 2 | // This file is not actually executed
|
|---|
| 3 | // It is just used by flow for typing
|
|---|
| 4 |
|
|---|
| 5 | const prefix: string = 'Invariant failed';
|
|---|
| 6 |
|
|---|
| 7 | export default function invariant(condition: mixed, message?: string | (() => string)) {
|
|---|
| 8 | if (condition) {
|
|---|
| 9 | return;
|
|---|
| 10 | }
|
|---|
| 11 | throw new Error(`${prefix}: ${message || ''}`);
|
|---|
| 12 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.