(body: string, at: number)
| 1762 | |
| 1763 | /** Where a declarator's initializer starts, past its `: Type` and `=`; -1 when it has none. */ |
| 1764 | export function initializerAt(body: string, at: number): number { |
| 1765 | for (let i = at; i < body.length; i++) { |
| 1766 | const ch = body[i]!; |
| 1767 | if (ch === '"' || ch === "'" || ch === '`') { |
| 1768 | i = skipString(body, i); |
| 1769 | if (i < 0) return -1; |
| 1770 | } else if (ch === '{' || ch === '(' || ch === '[') { |
| 1771 | i = matchBracket(body, i); |
| 1772 | if (i < 0) return -1; |
| 1773 | } else if (ch === '=') { |
| 1774 | if (body[i + 1] === '>' || body[i + 1] === '=') i++; |
| 1775 | else return i + 1; |
| 1776 | } else if (ch === ';' || ch === ',' || ch === '}' || ch === ')') return -1; |
| 1777 | } |
| 1778 | return -1; |
| 1779 | } |
| 1780 | |
| 1781 | /** |
| 1782 | * Where the statement or declarator from `from` ends: at a `;`, a closing |
no test coverage detected