MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / loaderValue

Function loaderValue

src/resolution/frameworks/react.ts:1637–1643  ·  view source on GitHub ↗

* What the function `text` resolves to when called, `param` handed to its * first parameter: its expression body's value, or what the first `return` * of its body hands back. Null for a function this does not read.

(text: string, outer: LoaderScope, param: Loaded | null = null)

Source from the content-addressed store, hash-verified

1635 * of its body hands back. Null for a function this does not read.
1636 */
1637function loaderValue(text: string, outer: LoaderScope, param: Loaded | null = null): Loaded | null {
1638 const fn = functionParts(text);
1639 if (!fn) return null;
1640 const scope = new Map(outer);
1641 topLevelItems(fn.params).forEach((p, i) => bindPattern(scope, parameterPattern(p), i === 0 ? param : null));
1642 return fn.block ? blockValue(fn.body, scope) : valueOf(fn.body, scope);
1643}
1644
1645/**
1646 * An arrow function's or a `function`'s parameter list and body, its

Callers 4

valueLoaderFunction · 0.85
lazyRouteReferenceFunction · 0.85
lazyPropertiesRenderFunction · 0.85
valueOfFunction · 0.85

Calls 6

functionPartsFunction · 0.85
parameterPatternFunction · 0.85
blockValueFunction · 0.85
topLevelItemsFunction · 0.70
bindPatternFunction · 0.70
valueOfFunction · 0.70

Tested by

no test coverage detected