/// import semaphore from 'semaphore'; export declare class TimeoutError extends Error { } export type Overwrite = Omit & NewT; export declare const rejectAfterDelay: (ms: number) => Promise; export declare const settleAllWithTimeout: (promises: Promise[], timeoutMs: number) => Promise; export type Maybe = T | null | undefined; export declare const isNullLike: (v: Maybe) => v is null | undefined; export declare const filterNullLike: (arr: Maybe[]) => T[]; /** * Unflattens an object with keys: * {abc: 1, 'foo.abc': 2, 'bar.abc': 2} * into: * {abc: 1, foo: {abc: 2}, bar: {abc: 2}} */ export declare const unflattenFields: (record: Record) => Record; export declare const toHexString: (byteArray: number[]) => string; export declare const hexCode: (decCode: number) => string; export declare const makeBatches: (items: T[], batchSize: number) => T[][]; export declare function partitionByKey(arr: Array, getKey: (item: T) => string): Record; export declare function partitionByKey(arr: Array, getKey: (item: T) => Maybe): Partial>; export declare function partitionByKeySingle(arr: Array, getKey: (item: T) => string): Record; export declare function partitionByKeySingle(arr: Array, getKey: (item: T) => Maybe): Partial>; /** Earlier items take precedence IF `getKey` is specified. */ export declare const dedupeList: (arr: T[], getKey?: ((item: T) => K) | undefined) => T[]; export declare const parseDate: (date: string | Date) => Date; export declare const runWithSem: (sem: semaphore.Semaphore, fn: () => Promise) => Promise; /** Differs from lodash's capitalize since it doesn't lower case everything else. */ export declare const capitalize: (str: string) => string; export declare const eqSet: (xs: Set, ys: Set) => boolean; export declare const nameToBuffer: (name: string, bytes?: number) => number[]; export declare const bufferToName: (buf: Buffer) => string; export declare function getRandomInt(min: number, max: number): number; export declare const equalWithNull: (a: Maybe, b: Maybe, eqFn?: ((a: T, b: T) => boolean) | undefined) => boolean; /** Amortized O(n) complexity */ export declare const removeNullBytes: (str: string) => string; /** Removes keys that have undefined values */ export declare const removeUndefinedKeys: (obj: object) => any; //# sourceMappingURL=utils.d.ts.map