1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3 | typeof define === 'function' && define.amd ? define(factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.invariant = factory());
|
5 | })(this, (function () { 'use strict';
|
6 |
|
7 | var isProduction = process.env.NODE_ENV === 'production';
|
8 | var prefix = 'Invariant failed';
|
9 | function invariant(condition, message) {
|
10 | if (condition) {
|
11 | return;
|
12 | }
|
13 | if (isProduction) {
|
14 | throw new Error(prefix);
|
15 | }
|
16 | var provided = typeof message === 'function' ? message() : message;
|
17 | var value = provided ? prefix + ": " + provided : prefix;
|
18 | throw new Error(value);
|
19 | }
|
20 |
|
21 | return invariant;
|
22 |
|
23 | }));
|