UNPKG

@activejs/core

Version:

Pragmatic, Reactive State Management for JavaScript Apps

51 lines (50 loc) 2.58 kB
import { UnitBase } from './abstract-unit-base'; import { KOf, UnitConfig } from '../models'; import { Selection } from './selection'; /** * Base for non-primitive Units. * * - NonPrimitiveUnitBase extends {@link UnitBase} * - Which further extends {@link Base} and `Observable` * * @category 2. Abstract */ export declare abstract class NonPrimitiveUnitBase<T, K extends KOf<T> = KOf<T>, V extends T[K] = T[K]> extends UnitBase<T> { protected constructor(config?: UnitConfig<T>); /** * Returns the names of the properties of the current {@link value} using `Object.keys`. \ * * In case of a GenericUnit, * if current {@link value} is null or undefined, it returns an empty `array`, \ * where `Object.keys` would have failed. * * @category Common List/Dict/Generic Units */ objectKeys(): string[]; /** * Returns an `array` of key/values of the properties of the current {@link value} using `Object.entries`. \ * * In case of a GenericUnit, * if current {@link value} is null or undefined, it returns an empty `array`, \ * where `Object.entries` would have failed. * * @category Common List/Dict/Generic Units */ objectEntries(): [string, V][]; /** * Returns an `array` of values of the properties of the current {@link value} using `Object.values`. \ * * In case of a GenericUnit, * if current {@link value} is null or undefined, it returns an empty `array`, \ * where `Object.values` would have failed. * * @category Common List/Dict/Generic Units */ objectValues(): V[]; select<K1 extends KOf<T>>(k1: K1): Selection<T[K1], this>; select<K1 extends KOf<T>, K2 extends KOf<T[K1]>>(k1: K1, k2: K2): Selection<T[K1][K2], this>; select<K1 extends KOf<T>, K2 extends KOf<T[K1]>, K3 extends KOf<T[K1][K2]>>(k1: K1, k2: K2, k3: K3): Selection<T[K1][K2][K3], this>; select<K1 extends KOf<T>, K2 extends KOf<T[K1]>, K3 extends KOf<T[K1][K2]>, K4 extends keyof T[K1][K2][K3]>(k1: K1, k2: K2, k3: K3, k4: K4): Selection<T[K1][K2][K3][K4], this>; select<K1 extends KOf<T>, K2 extends KOf<T[K1]>, K3 extends KOf<T[K1][K2]>, K4 extends keyof T[K1][K2][K3], K5 extends keyof T[K1][K2][K3][K4]>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): Selection<T[K1][K2][K3][K4][K5], this>; select<K1 extends KOf<T>, K2 extends KOf<T[K1]>, K3 extends KOf<T[K1][K2]>, K4 extends keyof T[K1][K2][K3], K5 extends keyof T[K1][K2][K3][K4]>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, ...path: (string | number)[]): Selection<any, this>; }