fix(package/cache): check if cached value is defined

This commit is contained in:
Linden
2022-09-18 22:53:04 +10:00
parent 21214728b7
commit 4657de6470

View File

@@ -5,13 +5,13 @@ export const cache: Record<string, any> = new Proxy(
{
get(target, key: string) {
const result = key ? target[key] : target;
if (result) return result;
if (result !== undefined) return result;
AddEventHandler(`ox_lib:cache:${key}`, (value: any) => {
target[key] = value;
});
target[key] = exports.ox_lib.cache(key);
target[key] = exports.ox_lib.cache(key) || false;
return target[key];
},
}