MCPcopy
hub / github.com/react-navigation/react-navigation / invariant

Function invariant

packages/core/src/utils/invariant.ts:22–40  ·  view source on GitHub ↗
(condition: boolean, format?: string, ...args: any[])

Source from the content-addressed store, hash-verified

20}
21
22function invariant(condition: boolean, format?: string, ...args: any[]) {
23 validateFormat(format);
24
25 if (!condition) {
26 let error: Error & { framesToPop?: number };
27 if (format === undefined) {
28 error = new Error(
29 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.'
30 );
31 } else {
32 let argIndex = 0;
33 error = new Error(format.replace(/%s/g, () => args[argIndex++]));
34 error.name = 'Invariant Violation';
35 }
36
37 error.framesToPop = 1; // we don't care about invariant's own frame
38 throw error;
39 }
40}
41
42export default invariant;

Callers 15

pushFunction · 0.50
jumpToIndexFunction · 0.50
jumpToFunction · 0.50
replaceAtIndexFunction · 0.50
resetFunction · 0.50
renderMethod · 0.50
getScreenForRouteNameFunction · 0.50
validateRouteConfigMapFunction · 0.50
createPathParserFunction · 0.50

Calls 1

validateFormatFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…