astro-ghostcms/.pnpm-store/v3/files/8a/6146f00f2c95a1dbb3c647eac49...

15 lines
465 B
Plaintext
Raw Normal View History

2024-02-14 14:10:47 +00:00
function getProperty(target, prop) {
if (typeof prop === "string") {
for (const [name, value] of Object.entries(target)) {
if (prop.toLowerCase() === name.toLowerCase()) {
return value;
}
}
}
return undefined;
}
export const proxyHeaders = (object) => new Proxy(object, {
get: (target, prop) => getProperty(target, prop),
has: (target, prop) => getProperty(target, prop) !== undefined
});