(key: string)
| 675 | } |
| 676 | |
| 677 | const splitIndexFrom = (key: string): Option.Option<[string, number]> => { |
| 678 | const match = key.match(STR_INDEX_REGEX) |
| 679 | if (match !== null) { |
| 680 | const matchedString = match[1] |
| 681 | const matchedIndex = match[3] |
| 682 | const optionalString = matchedString !== undefined && matchedString.length > 0 ? |
| 683 | Option.some(matchedString) : |
| 684 | Option.none() |
| 685 | const optionalIndex = pipe( |
| 686 | matchedIndex !== undefined && matchedIndex.length > 0 ? |
| 687 | Option.some(matchedIndex) : |
| 688 | Option.none(), |
| 689 | Option.flatMap(parseInteger) |
| 690 | ) |
| 691 | return Option.all([optionalString, optionalIndex]) |
| 692 | } |
| 693 | return Option.none() |
| 694 | } |
| 695 | |
| 696 | const parseInteger = (str: string): Option.Option<number> => { |
| 697 | const parsedIndex = Number.parseInt(str) |
no test coverage detected
searching dependent graphs…