foxts
Version:
Opinionated collection of common TypeScript utils by @SukkaW
2 lines (1 loc) • 405 B
JavaScript
let e=new Map;function t(e){return Array.from(Array(e).keys())}function r(r){if(e.has(r))return e.get(r);let n=t(r);return e.set(r,n),n}let 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}let f="function"==typeof WeakRef?a:r,i=f(0);export{i as EMPTY_ARRAY,f as createFixedArray,a as createFixedArrayWithGC,r as createFixedArrayWithoutGC};