Closed romainbar closed 1 year ago
@miktam will the changes of @daneren2005 (https://github.com/daneren2005/sizeof/commit/21428d8d22470a7eff1194196bc9b28e5c33a529) be merged? this is a useful contribution.
@ martin19, it seems useful. @daneren2005, could you make a PR, please?
awesome, thanks!
let a = new Uint8Array(50); sizeof(a); // 580 a.length; // 50
Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array... need be detected. Such as: if (a.constructor === Int8Array || a.constructor === Uint8Array || a.constructor === Uint8ClampedArray || a.constructor === Int16Array || a.constructor === Uint16Array) { size = a.BYTES_PER_ELEMENT * a.length; }