superfly-timeline
Version:
Resolver for defining objects with temporal boolean logic relationships on a timeline
38 lines • 1.9 kB
TypeScript
export declare function literal<T>(o: T): T;
export declare function compact<T>(arr: (T | undefined | null)[]): T[];
export declare function last<T>(arr: T[]): T | undefined;
/** Returns true if argument is an object (or an array, but NOT null) */
export declare function isObject(o: unknown): o is object;
export declare function reduceObj<V, R>(objs: {
[key: string]: V;
}, fcn: (memo: R, value: V, key: string, index: number) => R, initialValue: R): R;
/**
* Concatenate two arrays of values.
* This is a convenience function used to ensure that the two arrays are of the same type.
* @param arr0 The array of values to push into
* @param arr1 An array of values to push into arr0
*/
export declare function pushToArray<T>(arr0: T[], arr1: T[]): void;
export declare function clone<T>(obj: T): T;
export declare function uniq<T>(arr: T[]): T[];
type _Omit<V, K extends string> = V extends never ? any : Extract<K, keyof V> extends never ? Partial<V> : Pick<V, Exclude<keyof V, K>>;
export declare function omit<V extends object, K extends string>(obj: V, ...keys: (K | K[])[]): _Omit<V, K>;
export declare function sortBy<T>(arr: T[], fcn: (value: T) => string | number): T[];
export declare function isEmpty(obj: object): boolean;
export declare function ensureArray<T>(value: T | T[]): T[];
/**
* Slightly faster than Array.isArray().
* Note: Ensure that the value provided is not null!
*/
export declare function isArray(arg: object | any[]): arg is any[];
/**
* Helper function to simply assert that the value is of the type never.
* Usage: at the end of if/else or switch, to ensure that there is no fallthrough.
*/
export declare function assertNever(_value: never): void;
export declare function mapToObject<T>(map: Map<string, T>): {
[key: string]: T;
};
export declare function compareStrings(a: string, b: string): number;
export {};
//# sourceMappingURL=lib.d.ts.map