mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 07:37:11 -05:00
Remove lazyProperties -> we use withLazyProperties instead
This commit is contained in:
parent
37ed3e8209
commit
10952de3c5
1 changed files with 0 additions and 26 deletions
|
|
@ -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 a new issue