UNPKG

foxact

Version:

React Hooks/Utils done right. For browser, SSR, and React Server Components.

1 lines 452 B
const e=new Map;function t(e){const t=Array.from(Array(e).keys());return"development"===process.env.NODE_ENV&&Object.freeze(t),t}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 o(e){let r,o;return n.has(e)&&(o=(r=n.get(e)).deref()),o||(r=new WeakRef(o=t(e)),n.set(e,r)),o}const a="function"==typeof WeakRef?o:r;export{a as createFixedArray,o as createFixedArrayWithGC,r as createFixedArrayWithoutGC};