foxts
Version:
Opinionated collection of common TypeScript utils by @SukkaW
1 lines • 412 B
JavaScript
const e=new Map;function t(e){return Array.from(Array(e).keys())}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function a(e){let r,a;return n.has(e)&&(a=(r=n.get(e)).deref()),a||(r=new WeakRef(a=t(e)),n.set(e,r)),a}const o="function"==typeof WeakRef?a:r,c=o(0);export{c as EMPTY_ARRAY,o as createFixedArray,a as createFixedArrayWithGC,r as createFixedArrayWithoutGC};