MCPcopy
hub / github.com/aosabook/500lines / invariant

Function invariant

spreadsheet/code/as-react-livescript/main.js:12821–12847  ·  view source on GitHub ↗
(condition, format, a, b, c, d, e, f)

Source from the content-addressed store, hash-verified

12819 */
12820
12821 var invariant = function(condition, format, a, b, c, d, e, f) {
12822 if ("production" !== process.env.NODE_ENV) {
12823 if (format === undefined) {
12824 throw new Error('invariant requires an error message argument');
12825 }
12826 }
12827
12828 if (!condition) {
12829 var error;
12830 if (format === undefined) {
12831 error = new Error(
12832 'Minified exception occurred; use the non-minified dev environment ' +
12833 'for the full error message and additional helpful warnings.'
12834 );
12835 } else {
12836 var args = [a, b, c, d, e, f];
12837 var argIndex = 0;
12838 error = new Error(
12839 'Invariant Violation: ' +
12840 format.replace(/%s/g, function() { return args[argIndex++]; })
12841 );
12842 }
12843
12844 error.framesToPop = 1; // we don't care about invariant's own frame
12845 throw error;
12846 }
12847 };
12848
12849 module.exports = invariant;
12850

Callers 15

main.jsFile · 0.85
executeDirectDispatchFunction · 0.85
validateTypeDefFunction · 0.85
validateMethodOverrideFunction · 0.85
mixSpecIntoComponentFunction · 0.85
assertValidPropsFunction · 0.85
validateDangerousTagFunction · 0.85
getNextDescendantIDFunction · 0.85
getFirstCommonAncestorIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected