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

Function settle

src/resolution/frameworks/react.ts:1128–1145  ·  view source on GitHub ↗
(call: { map?: TableName }, open: number, close: number)

Source from the content-addressed store, hash-verified

1126 return /(?:^|[^\w$.])createRoutesFrom(?:Elements|Children)\s*$/.test(source.slice(Math.max(0, at - 40), at));
1127 };
1128 const settle = (call: { map?: TableName }, open: number, close: number): void => {
1129 const argAt = trivia(open + 1);
1130 if (argAt >= close) return;
1131 if (call.map) {
1132 const tags = routeTags.filter((t) => t.at > argAt && t.at < close);
1133 if (tags.length > 0 && mapsRouteFields(source.slice(argAt, close), tags)) sites.push({ name: call.map, at: open });
1134 return;
1135 }
1136 if (source[argAt] === '[' || source[argAt] === '{') {
1137 sites.push({ literal: argAt, at: open });
1138 return;
1139 }
1140 const id = /^[A-Za-z_$][\w$]*/.exec(source.slice(argAt, close));
1141 if (!id || /^createRoutesFrom(?:Elements|Children)$/.test(id[0])) return;
1142 const next = trivia(argAt + id[0].length);
1143 if (next === close || source[next] === ',') sites.push({ name: { name: id[0], call: false, at: argAt }, at: open });
1144 else if (source[next] === '(') sites.push({ name: { name: id[0], call: true, at: argAt }, at: open });
1145 };
1146 function unit(at: number, routeList = false): number {
1147 const ch = source[at];
1148 if (ch === '"' || ch === "'" || ch === '`') {

Callers 1

unitFunction · 0.70

Calls 4

triviaFunction · 0.85
mapsRouteFieldsFunction · 0.85
pushMethod · 0.80
execMethod · 0.65

Tested by

no test coverage detected