UNPKG

@tangential/core

Version:

Core types and support code for Tangential

48 lines (47 loc) 1.8 kB
import { ObjMap } from '../lang/obj-map'; export interface MapEntry<T> { key: string; value: T; } export declare const ResolveVoid: any; export declare class ObjectUtil { /** * Null safe version of Object.keys. * @param map * @returns {string[]} The keys for the map, or an empty array if the argument provided is falsy. */ static keys<T>(map: ObjMap<T>): string[]; /** * Provide a map of keys such that 'map[key]' provides a literal true value if the key is present, even if the value * on the source map is falsy. */ static toTruthMap(ary: string[]): ObjMap<boolean>; /** * Expand the map into an array of key-value pairs. * @param {ObjMap<T extends object>} map * @returns MapEntry<T> */ static entries<T>(map: ObjMap<T> | any): MapEntry<T>[]; /** * Provide the values of the map. * @param {ObjMap<T>} map * @returns MapEntry<T> */ static values<T>(map: ObjMap<T> | any): T[]; static isObject(value: any): boolean; static isFunction(value: any): boolean; static isNullOrDefined(value: any): boolean; static exists(value: any): boolean; static assignDeep(target: any, ...sources: any[]): any; static removeNullish<T>(obj: T): T; } export declare const cleanFirebaseMap: <T>(firebaseList: ObjMap<T>, deep?: boolean) => ObjMap<T>; export declare const pathExists: (object: any, path: string) => any; export declare const ensureExists: (object: any, path: string, value?: any) => any; export declare const removeIfExists: (object: any, path: string) => boolean; export declare const safe: (fn: () => any) => any; export declare const eachKey: <T extends {}>(objMap: T, fn: (arg?: T, key?: string) => any) => void; export interface Duo<X, Y> { x: X; y: Y; }