fix: inline the remember package

This commit is contained in:
Mythie
2024-05-29 22:25:23 +10:00
parent 5724e73d49
commit ebc547684a
4 changed files with 19 additions and 8 deletions

View File

@ -0,0 +1,18 @@
declare global {
// eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any
var __prisma_remember: Map<string, any>;
}
export function remember<T>(name: string, getValue: () => T): T {
const thusly = globalThis;
if (!thusly.__prisma_remember) {
thusly.__prisma_remember = new Map();
}
if (!thusly.__prisma_remember.has(name)) {
thusly.__prisma_remember.set(name, getValue());
}
return thusly.__prisma_remember.get(name);
}