Remove lazyProperties -> we use withLazyProperties instead
This commit is contained in:
parent
37ed3e8209
commit
10952de3c5
@ -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(
|
export function withLazyProperties(
|
||||||
object: Record<string, unknown>,
|
object: Record<string, unknown>,
|
||||||
properties: Record<string, () => unknown>
|
properties: Record<string, () => unknown>
|
||||||
|
Loading…
Reference in New Issue
Block a user