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

Function conditionalLoader

src/resolution/frameworks/react.ts:793–797  ·  view source on GitHub ↗

* The loader of a conditional's one branch that has one: SigNoz's `IS_DEV ? * React.lazy(() => import(…)) : null`. Null when neither branch loads, or both * do — the value is then one or the other.

(text: string)

Source from the content-addressed store, hash-verified

791 * do — the value is then one or the other.
792 */
793function conditionalLoader(text: string): string | null {
794 const branches = conditionalBranches(text);
795 const loaders = branches ? branches.map(loaderOf).filter((l): l is string => l !== null) : [];
796 return loaders.length === 1 ? loaders[0]! : null;
797}
798
799/** The two branches of a conditional expression, `test ? yes : no`; null for any other expression. */
800function conditionalBranches(text: string): [string, string] | null {

Callers 1

loaderOfFunction · 0.85

Calls 2

conditionalBranchesFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected