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

Function patternsBind

src/resolution/callback-synthesizer.ts:2425–2432  ·  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

2423 * not in a declaration of `require(…)` or `import(…)`.
2424 */
2425function patternsBind(code: string, patterns: Array<[number, number]>, name: string): boolean {
2426 for (const [open, close] of patterns) {
2427 for (let at = code.indexOf(name, open); at !== -1 && at < close; at = code.indexOf(name, at + name.length)) {
2428 if (bindingElementAt(code, at, name.length)) return true;
2429 }
2430 }
2431 return false;
2432}
2433
2434/**
2435 * 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