(map: Map<string, string[]>, key: string)
| 83 | } |
| 84 | |
| 85 | function shiftQueue(map: Map<string, string[]>, key: string): string | null { |
| 86 | const queue = map.get(key); |
| 87 | if (!queue || queue.length === 0) { |
| 88 | return null; |
| 89 | } |
| 90 | const value = queue.shift() ?? null; |
| 91 | if (!queue.length) { |
| 92 | map.delete(key); |
| 93 | } else { |
| 94 | map.set(key, queue); |
| 95 | } |
| 96 | return value; |
| 97 | } |
| 98 | |
| 99 | function removeFromQueue(map: Map<string, string[]>, key: string, value: string): void { |
| 100 | const queue = map.get(key); |