Read an array-valued field — `key: [ ... ]` — as the raw inner text.
(obj: string, name: string)
| 983 | |
| 984 | /** Read an array-valued field — `key: [ ... ]` — as the raw inner text. */ |
| 985 | function parseArrayField(obj: string, name: string): string | null { |
| 986 | const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*\\[`); |
| 987 | const m = re.exec(obj); |
| 988 | if (!m) return null; |
| 989 | const open = m.index + m[0].length - 1; |
| 990 | const close = matchingClose(obj, open); |
| 991 | if (close < 0) return null; |
| 992 | return obj.slice(open + 1, close); |
| 993 | } |
no test coverage detected