UNPKG

highly

Version:

> TODO: create docs

194 lines (108 loc) 10.7 kB
declare function drop(n: number): <T>(list: ArrayLike<T>) => T[]; declare function dropLast(n: number): <T>(list: ArrayLike<T>) => T[]; declare function dropLastWhile<V>(predicate: (v: V, i: number, a: ArrayLike<V>) => boolean): <T extends V = V>(list: ArrayLike<T>) => T[]; declare function dropWhile<V>(predicate: (v: V, i: number, a: ArrayLike<V>) => boolean): <T extends V = V>(list: ArrayLike<T>) => T[]; declare function every<V>(predicate: (v: V, i: number, list: ArrayLike<V>) => boolean): <T extends V = V>(list: ArrayLike<T>) => boolean; declare function filter<V>(fn: (v: V, i: number, list: V[]) => boolean): <T extends V>(list: T[]) => T[]; declare function find<V>(predicate: (v: V, i: number, a: Readonly<ArrayLike<V>>) => boolean, fromIndex?: number): <T extends V>(list: Readonly<ArrayLike<T>>) => T | undefined; declare function findIndex<V>(predicate: (v: V, i: number, a: Readonly<ArrayLike<V>>) => boolean, fromIndex?: number): <T extends V = V>(list: Readonly<ArrayLike<T>>) => number; declare function findLast<V>(predicate: (v: V, i: number, list: Readonly<ArrayLike<V>>) => boolean, startIndex?: number): <T extends V>(list: Readonly<ArrayLike<T>>) => T | undefined; declare function findLastIndex<V>(predicate: (v: V, i: number, a: Readonly<ArrayLike<V>>) => boolean, fromIndex?: number): <T extends V>(list: Readonly<ArrayLike<T>>) => number; declare function forEach<V>(cb: (v: V, i: string | number, a: Readonly<ArrayLike<V>>) => void): <T extends V, A extends Readonly<ArrayLike<T>>>(list: A) => A; declare function forEachRight<V>(cb: (v: V, i: string | number, a: Readonly<ArrayLike<V>>) => void): <T extends V, A extends Readonly<ArrayLike<T>>>(list: A) => A; declare function fork<V>(condition: (item: V, index: number) => boolean): <T extends V>(list: readonly T[]) => [T[], T[]]; declare function groupBy<V, K extends PropertyKey = PropertyKey>(iteratee: (v: V, index: number, list: Readonly<ArrayLike<V>>) => K): <T extends V = V>(list: Readonly<ArrayLike<T>>) => Record<K, T[]>; declare function inArray<T>(list: Readonly<ArrayLike<T>>): <V>(value: V) => boolean; declare function indexOf<V>(value: V, fromIndex?: number): <T>(list: Readonly<ArrayLike<T>>) => number; declare function map<V, R>(fn: (v: V, i: number, list: ArrayLike<V>) => R, useSelf?: boolean): <T extends V>(list: T[]) => R[]; declare function some<V>(predicate: (v: V, i: number, list: ArrayLike<V>) => boolean, useSelf?: false): <T extends V>(list: T[]) => boolean; declare function some<V>(predicate: (v: V, i: number, list: ArrayLike<V>) => boolean, useSelf: true): <T extends V>(list: ArrayLike<T>) => boolean; declare function take<N extends number>(n: N): <T>(list: ArrayLike<T>) => T[]; declare function takeLast(n: number): <T>(list: ArrayLike<T>) => T[]; declare function takeLastWhile<V>(predicate: (v: V, i: number, a: ArrayLike<V>) => boolean): <T extends V = V>(list: ArrayLike<T>) => T[]; declare function takeWhile<V>(predicate: (v: V, i: number, a: ArrayLike<V>) => boolean): <T extends V = V>(list: ArrayLike<T>) => T[]; declare function sleep(ms: number): Promise<void>; interface RetryOptions<R> { maxAttempts: number; delayMs?: number; canNext?: (err: Error | null, attempts: number) => boolean; canDone?(result: R, i: number): boolean; } declare function retry<A extends unknown[], R>(fn: <This>(this: This, ...args: A) => Promise<R>, options: RetryOptions<R>): <This>(this: This, ...args: A) => Promise<R>; declare function always<T>(v: T): () => T; declare function o<R, B, A>(f: (b: B) => R, g: (a: A) => B): (a: A) => R; declare function and<A extends unknown[]>(first: (...args: A) => boolean, second: (...args: A) => boolean): (...args: A) => boolean; declare function or<A extends unknown[]>(first: (...args: A) => boolean, second: (...args: A) => boolean): (...args: A) => boolean; declare function not<A extends unknown[]>(predicate: (...args: A) => boolean): (...args: A) => boolean; declare function add(num: string, castToNum?: false): (n: string | number) => string; declare function add(num: number, castToNum?: false): <T extends number | string>(n: T) => T extends string ? string : number; declare function add<T extends string | number>(num: T, castToNum: true): (n: string | number) => number; declare function sub(subtrahend: number): (minuend: number) => number; declare function mul(multiplier: number): (multiplicand: number) => number; declare function div(divisor: number): (minuend: number) => number; declare function pow(exponent: number): (base: number) => number; declare function between(minNum: number, maxNum: number, mode?: '[)' | '[]' | '()' | '(]'): (n: number) => boolean; declare function clamp(lower: number, upper: number): (num: number) => number; declare function gt(rightNum: number): (n: number) => boolean; declare function gte(rightNum: number): (n: number) => boolean; declare function lt(rightNum: number): (n: number) => boolean; declare function lte(rightNum: number): (n: number) => boolean; declare const entries: <K extends string = string, V = unknown>(obj: Record<K, V>) => [K, V][]; declare function forIn<V, K extends PropertyKey = PropertyKey, T extends Record<K, V> = Record<K, V>>(cb: (v: V, i: K, a: T) => void): <O extends T>(obj: O) => O; declare function forOwn<V, K extends PropertyKey = PropertyKey, T extends Record<K, V> = Record<K, V>>(cb: (v: V, i: K, a: T) => void): <O extends T>(obj: O) => O; declare function is<T>(v: T): (x: unknown) => x is T; declare function keys(x: void): []; declare function keys<T>(x: T): (keyof T & string)[]; type OmitUnion<T, K extends PropertyKey> = T extends void ? never : Pick<T, Exclude<keyof T, Extract<keyof T, K>>>; declare function omit<K extends string>(names: K[] | K): <O extends Record<K, unknown> = Record<K, unknown>>(it: O) => OmitUnion<O, K>; declare function omitBy<V, K extends string = string, T extends Record<K, V> = Record<K, V>>(predicate: (v: V, k: K, o: Readonly<T>) => boolean): <O extends T>(obj: Readonly<O>) => Partial<O>; type PickUnion<T, K extends PropertyKey> = T extends unknown ? Pick<T, Extract<keyof T, K>> : never; declare function pick<K extends PropertyKey = PropertyKey>(names: K[]): <T extends Record<K, unknown>>(it: T) => PickUnion<T, K>; declare function pickBy<V, K extends string = string, T extends Record<K, V> = Record<K, V>>(predicate: (v: V, k: K, o: Readonly<T>) => boolean): <O extends T>(obj: Readonly<O>) => Partial<O>; declare const values: <K extends string = string, V = unknown>(obj: Record<K, V>) => V[]; declare const F: () => false; declare function identity<K extends PropertyKey, V extends string | number | boolean | object | V[] | Record<K, V>>(value: V): V; declare function identity<T>(value: T): T; declare const isArray: <T>(value: unknown) => value is T[]; declare const isBoolean: (v: unknown) => v is boolean; declare const isDate: (value: unknown) => value is Date; declare function isFalsy(v: unknown): boolean; declare const isFinite: <T>(it: T) => it is T & number; declare const isFunction: <T>(v: T) => v is T & Function; declare const isInteger: <T extends number = number>(it: unknown) => it is T; declare const isMap: <K, V>(it: unknown) => it is Map<K, V>; declare const isWeakMap: <K extends object, V>(it: unknown) => it is WeakMap<K, V>; declare const isNaN: (x: unknown) => boolean; declare function isNative<T>(value: T): value is T & Function; declare function isNil<T>(value: unknown): value is T & (undefined | null); declare const isNull: (x: unknown) => x is null; declare const isNumber: (v: unknown) => v is number; declare function isNumeric<T extends string | number = string | number>(value: unknown): value is T; declare function isObjectLike<T>(value: T): value is T & object; declare function isPlainObject<T>(value: T): value is T & object; declare function isPrimitive<T>(value: T): value is T & (string | number | boolean | symbol | bigint | null | undefined); declare const isPromise: <T>(it: unknown) => it is Promise<T>; declare function isPromiseLike<T>(it: unknown): it is Promise<T>; declare const isRegExp: (it: unknown) => it is RegExp; declare const isSafeInteger: (x: unknown) => x is number; declare function isScalar(x: unknown): x is number | string | boolean; declare const isSet: <T>(it: unknown) => it is Set<T>; declare const isWeakSet: <T extends object = object>(it: unknown) => it is WeakSet<T>; declare const isString: (v: unknown) => v is string; declare const isSymbol: (v: unknown) => v is symbol; declare function isTruthy(v: unknown): boolean; type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; declare function isTypedArray<T extends TypedArray = TypedArray>(x: unknown): x is T; declare const isUint8Array: (value: unknown) => value is Uint8Array; declare const isUint16Array: (value: unknown) => value is Uint16Array; declare const isUint32Array: (value: unknown) => value is Uint32Array; declare const isInt8Array: (value: unknown) => value is Int8Array; declare const isInt16Array: (value: unknown) => value is Int16Array; declare const isInt32Array: (value: unknown) => value is Int32Array; declare const isUndefined: (x: unknown) => x is undefined; declare function noop<A extends unknown[]>(...args: A): void; declare const T: () => true; declare function trim(chars: string | RegExp, strictMode?: boolean): (input: string) => string; declare function trimStart(chars: string | RegExp | ((c: string) => boolean), strictMode?: boolean): (input: string) => string; declare function trimEnd(chars: string | RegExp | ((c: string) => boolean), strictMode?: boolean): (input: string) => string; export { F, RetryOptions, T, TypedArray, add, always, and, between, clamp, div, drop, dropLast, dropLastWhile, dropWhile, entries, every, filter, find, findIndex, findLast, findLastIndex, forEach, forEachRight, forIn, forOwn, fork, groupBy, gt, gte, identity, inArray, indexOf, is, isArray, isBoolean, isDate, isFalsy, isFinite, isFunction, isInt16Array, isInt32Array, isInt8Array, isInteger, isMap, isNaN, isNative, isNil, isNull, isNumber, isNumeric, isObjectLike, isPlainObject, isPrimitive, isPromise, isPromiseLike, isRegExp, isSafeInteger, isScalar, isSet, isString, isSymbol, isTruthy, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUndefined, isWeakMap, isWeakSet, keys, lt, lte, map, mul, noop, not, o, omit, omitBy, or, pick, pickBy, pow, retry, sleep, some, sub, take, takeLast, takeLastWhile, takeWhile, trim, trimEnd, trimStart, values };