Remove lazyProperties -> we use withLazyProperties instead

This commit is contained in:
Henrik Giesel 2021-04-01 22:24:22 +02:00
parent 37ed3e8209
commit 10952de3c5

View File

@ -1,29 +1,3 @@
export function lazyProperties(
object: Record<string, unknown>,
properties: Record<string, () => unknown>
): void {
const propertyDescriptorMap = Object.entries(properties)
.map(([name, getter]: [string, () => unknown]): [
string,
PropertyDescriptor
] => [
name,
{
get: getter,
enumerable: true,
},
])
.reduce(
(
accumulator: PropertyDescriptorMap,
[name, property]
): PropertyDescriptorMap => ((accumulator[name] = property), accumulator),
{}
);
Object.defineProperties(object, propertyDescriptorMap);
}
export function withLazyProperties(
object: Record<string, unknown>,
properties: Record<string, () => unknown>