* Check if value is already a Uint8Array[] batch (fast path). * @returns {boolean}
(value)
| 176 | * @returns {boolean} |
| 177 | */ |
| 178 | function isUint8ArrayBatch(value) { |
| 179 | if (!ArrayIsArray(value)) return false; |
| 180 | const len = value.length; |
| 181 | if (len === 0) return true; |
| 182 | // Fast path: single-element batch (most common from transforms) |
| 183 | if (len === 1) return isUint8Array(value[0]); |
| 184 | // Check first and last before iterating all elements |
| 185 | if (!isUint8Array(value[0]) || !isUint8Array(value[len - 1])) return false; |
| 186 | if (len === 2) return true; |
| 187 | for (let i = 1; i < len - 1; i++) { |
| 188 | if (!isUint8Array(value[i])) return false; |
| 189 | } |
| 190 | return true; |
| 191 | } |
| 192 | |
| 193 | function* yieldBoundedBatch(batch) { |
| 194 | if (batch.length === 0) { |
no test coverage detected
searching dependent graphs…