fractal-core
Version:
A minimalist and well crafted app, content or component is our conviction
42 lines (41 loc) • 1.79 kB
TypeScript
export declare const assoc: (key: string) => (value: any) => (obj: any) => any;
export interface FnIndex {
[key: string]: {
(any: any): any;
};
}
export declare const evolve: (index: FnIndex) => (obj: any) => any;
export declare const evolveKey: (key: string) => (fn: (any: any) => any) => (obj: any) => any;
export declare function pipe(...args: any[]): (value: any) => any;
export interface KeyValuePair extends Array<any> {
0: string;
1: any;
}
export declare function mapToObj<U>(arr: U[], fn: {
(idx: any, value?: U): KeyValuePair;
}): {
[key: string]: any;
};
export declare function merge(objSrc: any): (obj: any) => any;
export declare const deepmerge: any;
export declare const deepmergeAll: any;
export interface AsyncMapFn<U, V> {
(element: U, index: number, array: U[]): Promise<V>;
}
export declare const mapAsync: <U, V>(arr: U[], fn: AsyncMapFn<U, V>) => Promise<V[]>;
export interface AsyncFilterFn<U> {
(element: U, index: number, array: U[]): Promise<boolean>;
}
export declare const filterAsync: <U>(arr: U[], fn: AsyncFilterFn<U>) => Promise<U[]>;
export interface AsyncReduceFn<U, V> {
(acumulator: V, element: U, index: number): Promise<V>;
}
export declare const reduceAsync: <U, V>(arr: U[], fn: AsyncReduceFn<U, V>, v0: V) => Promise<V>;
export declare const all: (arr: Promise<any>[]) => Promise<any[]>;
export declare const seq: (...arr: Promise<any>[]) => Promise<void>;
export declare const range: (a: number, b: number) => any[];
export declare const waitMS: (ms: number) => Promise<{}>;
export declare const sum: (numbers: number[]) => number;
export declare const getPath: (path: string[], obj: any) => any;
export declare const getPaths: (paths: string[][], obj: any) => any[];
export declare function guid(): string;