UNPKG

veffect

Version:

powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha

20 lines 558 B
/** * @since 2.0.0 */ import * as version from "./internal/version.js"; const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${/*#__PURE__*/version.getCurrentVersion()}`); if (!(globalStoreId in globalThis)) { ; globalThis[globalStoreId] = /*#__PURE__*/new Map(); } const globalStore = globalThis[globalStoreId]; /** * @since 2.0.0 */ export const globalValue = (id, compute) => { if (!globalStore.has(id)) { globalStore.set(id, compute()); } return globalStore.get(id); }; //# sourceMappingURL=GlobalValue.js.map