| 1 | const draftIDPattern = /draft:([0-9a-fA-F]{32})/g; |
| 2 | |
| 3 | export function draftIDsFromSubmit(input: string): string[] { |
| 4 | const ids: string[] = []; |
| 5 | const seen = new Set<string>(); |
| 6 | draftIDPattern.lastIndex = 0; |
| 7 | let match: RegExpExecArray | null; |
| 8 | while ((match = draftIDPattern.exec(input))) { |
| 9 | const id = match[1].toLowerCase(); |
| 10 | if (seen.has(id)) continue; |
| 11 | seen.add(id); |
| 12 | ids.push(id); |
| 13 | } |
| 14 | return ids; |
| 15 | } |
| 16 |