Read an array-valued field — `key: [ ... ]` — as the raw inner text.
(obj: string, name: string)
| 756 | |
| 757 | /** Read an array-valued field — `key: [ ... ]` — as the raw inner text. */ |
| 758 | function parseArrayField(obj: string, name: string): string | null { |
| 759 | const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*\\[`); |
| 760 | const m = re.exec(obj); |
| 761 | if (!m) return null; |
| 762 | const open = m.index + m[0].length - 1; |
| 763 | const close = matchingClose(obj, open); |
| 764 | if (close < 0) return null; |
| 765 | return obj.slice(open + 1, close); |
| 766 | } |
no test coverage detected