* Append normalized transform result batches to an array (async). * @param {Array } target * @param {*} result * @returns {Promise |undefined}
(target, result)
| 405 | * @returns {Promise<void>|undefined} |
| 406 | */ |
| 407 | function appendTransformResultAsync(target, result) { |
| 408 | if (result === null) { |
| 409 | return; |
| 410 | } |
| 411 | if (isUint8ArrayBatch(result)) { |
| 412 | if (result.length > 0) { |
| 413 | ArrayPrototypePush(target, result); |
| 414 | } |
| 415 | return; |
| 416 | } |
| 417 | if (isUint8Array(result)) { |
| 418 | ArrayPrototypePush(target, [result]); |
| 419 | return; |
| 420 | } |
| 421 | if (typeof result === 'string') { |
| 422 | ArrayPrototypePush(target, [toUint8Array(result)]); |
| 423 | return; |
| 424 | } |
| 425 | if (isAnyArrayBuffer(result)) { |
| 426 | ArrayPrototypePush(target, [new Uint8Array(result)]); |
| 427 | return; |
| 428 | } |
| 429 | if (ArrayBufferIsView(result)) { |
| 430 | ArrayPrototypePush(target, [arrayBufferViewToUint8Array(result)]); |
| 431 | return; |
| 432 | } |
| 433 | return appendTransformResultAsyncSlow(target, result); |
| 434 | } |
| 435 | |
| 436 | async function appendTransformResultAsyncSlow(target, result) { |
| 437 | for await (const batch of processTransformResultAsync(result)) { |
no test coverage detected
searching dependent graphs…