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

Function patternsBind

src/resolution/callback-synthesizer.ts:2362–2369  ·  view source on GitHub ↗

* Whether one of `patterns` in `code` binds `name` (`bindingElementAt`), so * not in a declaration of `require(…)` or `import(…)`.

(code: string, patterns: Array<[number, number]>, name: string)

Source from the content-addressed store, hash-verified

2360 * not in a declaration of `require(…)` or `import(…)`.
2361 */
2362function patternsBind(code: string, patterns: Array<[number, number]>, name: string): boolean {
2363 for (const [open, close] of patterns) {
2364 for (let at = code.indexOf(name, open); at !== -1 && at < close; at = code.indexOf(name, at + name.length)) {
2365 if (bindingElementAt(code, at, name.length)) return true;
2366 }
2367 }
2368 return false;
2369}
2370
2371/**
2372 * Whether the name at `at` is an element of a pattern that binds it — `{

Callers 1

destructuredAtTopFunction · 0.85

Calls 1

bindingElementAtFunction · 0.85

Tested by

no test coverage detected