| 1 | /** Splits a stream of text into the non-empty records between `separator`s, holding a record cut across chunks until it completes. */ |
| 2 | export async function* |
| 3 | chunks: AsyncIterable |
| 4 | separator: string, |
| 5 | ) { |
| 6 | let carry = |
| 7 | |
| 8 | for await (const |
| 9 | carry += chunk; |
| 10 | const records = |
| 11 | carry = records. |
| 12 | for (const record |
| 13 | } |
| 14 | |
| 15 | if (carry) yield |
| 16 | } |