import { RawCoValue } from "cojson"; import { CoValue } from "../internal.js"; const weakMap = new WeakMap(); export const coValuesCache = { get: (raw: RawCoValue, compute: () => V) => { const cached = weakMap.get(raw); if (cached) { return cached as V; } const computed = compute(); weakMap.set(raw, computed); return computed; }, };