(queue)
| 69175 | /** |
| 69176 | * Splits the stream into two streams which can be |
| 69177 | * independently read from at different speeds. |
| 69178 | */ |
| 69179 | tee() { |
| 69180 | const left = []; |
| 69181 | const right = []; |
| 69182 | const iterator2 = this.iterator(); |
| 69183 | const teeIterator = (queue) => { |
| 69184 | return { |
| 69185 | next: () => { |
| 69186 | if (queue.length === 0) { |
| 69187 | const result = iterator2.next(); |
| 69188 | left.push(result); |
| 69189 | right.push(result); |
| 69190 | } |
| 69191 | return queue.shift(); |