(block, fallbackGroup)
| 345 | } |
| 346 | |
| 347 | function findFallbackChildren(block, fallbackGroup) { |
| 348 | const textPattern = new RegExp(`\\btext\\s*:\\s*["']${escapeRegExp(fallbackGroup)}["']`, "g"); |
| 349 | let textMatch; |
| 350 | |
| 351 | while ((textMatch = textPattern.exec(block)) !== null) { |
| 352 | const childrenPattern = /\bchildren\s*:\s*\[/g; |
| 353 | childrenPattern.lastIndex = textMatch.index + textMatch[0].length; |
| 354 | const childrenMatch = childrenPattern.exec(block); |
| 355 | if (!childrenMatch) { |
| 356 | continue; |
| 357 | } |
| 358 | |
| 359 | const arrayStart = childrenMatch.index + childrenMatch[0].lastIndexOf("["); |
| 360 | const arrayEnd = findMatchingBracket(block, arrayStart); |
| 361 | if (arrayEnd !== -1) { |
| 362 | return { start: arrayStart, end: arrayEnd }; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | return null; |
| 367 | } |
| 368 | |
| 369 | function findLineStart(source, index) { |
| 370 | const lineBreak = source.lastIndexOf("\n", index); |
no test coverage detected