newline-async-iterator
Version:
Line-by-line async iterator for the browser and node
14 lines (13 loc) • 471 B
JavaScript
// Feature detection - no global modifications per polyfill-removal plans
/**
* Convert a Uint8Array to a number array
* Compatible with Node 0.8+ (no Array.from)
*/ export function uint8ArrayToArray(uint8Array) {
if (typeof Array.from === 'function') return Array.from(uint8Array);
// Fallback for old environments without Array.from
const arr = [];
for(let i = 0; i < uint8Array.length; i++){
arr.push(uint8Array[i]);
}
return arr;
}