The text between an opening `(` at `open` and its matching `)`, or null. Strings are skipped.
(text: string, open: number)
| 610 | |
| 611 | /** The text between an opening `(` at `open` and its matching `)`, or null. Strings are skipped. */ |
| 612 | function balancedArgs(text: string, open: number): string | null { |
| 613 | let depth = 1; |
| 614 | let quote = ''; |
| 615 | for (let i = open; i < text.length && i < open + 4000; i++) { |
| 616 | const ch = text[i]!; |
| 617 | if (quote) { |
| 618 | if (ch === '\\') i++; |
| 619 | else if (ch === quote) quote = ''; |
| 620 | continue; |
| 621 | } |
| 622 | if (ch === '"' || ch === "'") quote = ch; |
| 623 | else if (ch === '(' || ch === '[' || ch === '{') depth++; |
| 624 | else if (ch === ')' || ch === ']' || ch === '}') { |
| 625 | depth--; |
| 626 | if (depth === 0) return text.slice(open, i); |
| 627 | } |
| 628 | } |
| 629 | return null; |
| 630 | } |
| 631 | |
| 632 | // Directory patterns |
| 633 | const MODEL_DIRS = ['models', 'app/models', 'src/models']; |
no outgoing calls
no test coverage detected