Options
All
  • Public
  • Public/Protected
  • All
Menu

NewDash

Index

References

Namespaces

Classes Functional

Classes Other

Type aliases

Properties

Variables

Functions Function

References

add

Renames and re-exports __type

addPrefix

Renames and re-exports __type

addSuffix

Renames and re-exports __type

any

Renames and re-exports __type

ary

Renames and re-exports __type

assign

Renames and re-exports __type

assignIn

Renames and re-exports __type

at

Renames and re-exports __type

attempt

Renames and re-exports __type

cacheIt

Renames and re-exports __type

cacheItTTL

Renames and re-exports __type

capitalize

Renames and re-exports __type

ceil

Renames and re-exports __type

chunk

Renames and re-exports __type

clone

Renames and re-exports __type

cloneDeep

Renames and re-exports __type

closest

Renames and re-exports __type

concat

Renames and re-exports __type

cond

Renames and re-exports __type

conforms

Renames and re-exports __type

conformsTo

Renames and re-exports __type

constant

Renames and re-exports __type

countBy

Renames and re-exports __type

createTimeoutPromise

Renames and re-exports __type

curry

Renames and re-exports __type

debounce

Renames and re-exports __type

defaultTo

Renames and re-exports __type

delay

Renames and re-exports __type

differenceBy

Renames and re-exports __type

distance

Renames and re-exports __type

divide

Renames and re-exports __type

eq

Renames and re-exports __type

escapeRegExp

Renames and re-exports __type

every

Renames and re-exports __type

everyValue

Renames and re-exports __type

filter

Renames and re-exports __type

filterObject

Renames and re-exports __type

find

Renames and re-exports __type

first

Renames and re-exports __type

flatMap

Renames and re-exports __type

flatMapDeep

Renames and re-exports __type

flatten

Renames and re-exports __type

flattenDeep

Renames and re-exports __type

flip

Renames and re-exports __type

forEach

Renames and re-exports __type

forOwn

Renames and re-exports __type

forOwnRight

Renames and re-exports __type

fromEntries

Renames and re-exports __type

functions

Renames and re-exports __type

get

Renames and re-exports __type

groupBy

Renames and re-exports __type

has

Renames and re-exports __type

head

Renames and re-exports __type

includes

Renames and re-exports __type

initial

Renames and re-exports __type

intersection

Renames and re-exports __type

intersectionBy

Renames and re-exports __type

intersectionWith

Renames and re-exports __type

invert

Renames and re-exports __type

invertBy

Renames and re-exports __type

invoke

Renames and re-exports __type

invokeMap

Renames and re-exports __type

isArguments

Renames and re-exports __type

isArray

Renames and re-exports __type

isArrayLike

Renames and re-exports __type

isCircular

Renames and re-exports __type

isDate

Renames and re-exports __type

isEmpty

Renames and re-exports __type

isEqual

Renames and re-exports __type

isEqualWith

Renames and re-exports __type

isError

Renames and re-exports __type

isFunction

Renames and re-exports __type

isInstance

Renames and re-exports __type

isMap

Renames and re-exports __type

isNull

Renames and re-exports __type

isNumber

Renames and re-exports __type

isObject

Renames and re-exports __type

isString

Renames and re-exports __type

isSubClass

Renames and re-exports __type

join

Renames and re-exports __type

keys

Renames and re-exports __type

last

Renames and re-exports __type

lastIndexOf

Renames and re-exports __type

lowerCase

Renames and re-exports __type

lt

Renames and re-exports __type

map

Renames and re-exports __type

mapKeys

Renames and re-exports __type

mapValues

Renames and re-exports __type

matchesProperty

Renames and re-exports __type

max

Renames and re-exports __type

maxBy

Renames and re-exports __type

mean

Renames and re-exports __type

meanBy

Renames and re-exports __type

merge

Renames and re-exports __type

mergeWith

Renames and re-exports __type

method

Renames and re-exports __type

methodOf

Renames and re-exports __type

min

Renames and re-exports __type

minBy

Renames and re-exports __type

omit

Renames and re-exports __type

over

Renames and re-exports __type

overArgs

Renames and re-exports __type

overEvery

Renames and re-exports __type

overSome

Renames and re-exports __type

pad

Renames and re-exports __type

padEnd

Renames and re-exports __type

padStart

Renames and re-exports __type

pick

Renames and re-exports __type

pickBy

Renames and re-exports __type

pull

Renames and re-exports __type

pullAll

Renames and re-exports __type

pullAllWith

Renames and re-exports __type

pullAt

Renames and re-exports __type

random

Renames and re-exports __type

range

Renames and re-exports __type

reduce

Renames and re-exports __type

reject

Renames and re-exports __type

remove

Renames and re-exports __type

repeat

Renames and re-exports __type

replace

Renames and re-exports __type

retry

Renames and re-exports __type

series

Renames and re-exports __type

set

Renames and re-exports __type

size

Renames and re-exports __type

sleep

Renames and re-exports __type

slice

Renames and re-exports __type

some

Renames and re-exports __type

someValues

Renames and re-exports __type

sortedIndex

Renames and re-exports __type

sortedIndexBy

Renames and re-exports __type

sortedIndexOf

Renames and re-exports __type

sortedLastIndex

Renames and re-exports __type

sortedLastIndexBy

Renames and re-exports __type

sortedLastIndexOf

Renames and re-exports __type

sortedUniq

Renames and re-exports __type

sortedUniqBy

Renames and re-exports __type

split

Renames and re-exports __type

sum

Renames and re-exports __type

sumBy

Renames and re-exports __type

take

Renames and re-exports __type

takeRight

Renames and re-exports __type

throttle

Renames and re-exports __type

timeIt

Renames and re-exports __type

times

Renames and re-exports __type

toArray

Renames and re-exports __type

toLower

Renames and re-exports __type

toNumber

Renames and re-exports __type

toUpper

Renames and re-exports __type

trim

Renames and re-exports __type

trimEnd

Renames and re-exports __type

trimPrefix

Renames and re-exports __type

trimStart

Renames and re-exports __type

trimSuffix

Renames and re-exports __type

unWrap

Renames and re-exports __type

unionBy

Renames and re-exports __type

uniq

Renames and re-exports __type

uniqBy

Renames and re-exports __type

uniqWith

Renames and re-exports __type

uniqueId

Renames and re-exports __type

unset

Renames and re-exports __type

update

Renames and re-exports __type

values

Renames and re-exports __type

words

Renames and re-exports __type

wrap

Renames and re-exports __type

Type aliases

AsyncFunction

AsyncFunction<P, R>: (...args: P) => Promise<R>

Type parameters

  • P: any[] = any[]

  • R = any

Type declaration

    • (...args: P): Promise<R>
    • async function

      Parameters

      • Rest ...args: P

      Returns Promise<R>

Class

Class<T>: new (...args: any[]) => T

Type parameters

  • T = any

Type declaration

    • new (...args: any[]): T
    • Class constructor

      Parameters

      • Rest ...args: any[]

      Returns T

DeepPartial

DeepPartial<T>: { [ P in keyof T]?: T[P] extends infer U[] ? DeepPartial<U>[] : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]> }

Same as Partial but goes deeper and makes Partial all its properties and sub-properties.

Type parameters

  • T

FirstElement

FirstElement<T>: T extends [infer U, ...any[]] ? U : any

first element type of array types

Type parameters

  • T: ArrayLike<any>

GeneralFunction

GeneralFunction<Args, ReturnType>: (...args: Args) => ReturnType

Type parameters

  • Args: any[] = any[]

  • ReturnType: any = any

Type declaration

    • (...args: Args): ReturnType
    • general function in typescript

      Parameters

      • Rest ...args: Args

      Returns ReturnType

JSType

JSType: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"

possible values of typeof object

Keys

Keys<T>: keyof T

keys of object

Type parameters

  • T

OptionalParameters

OptionalParameters<T>: T extends (...args: infer P) => any ? { [ K in keyof P]?: P[K] } : never

optional version of Parameters

Type parameters

  • T: Function

Partial

Partial<T>: { [ P in keyof T]?: T[P] }

Partial Object

Type parameters

  • T

Predicate

Predicate<T>: (value?: T, index?: any, collection?: any) => boolean

Type parameters

  • T

Type declaration

    • (value?: T, index?: any, collection?: any): boolean
    • Parameters

      • Optional value: T
      • Optional index: any
      • Optional collection: any

      Returns boolean

ReturnType

ReturnType<T>: T extends (...args: any) => infer R ? R : any

return type of function

Type parameters

  • T

UnwrapPromise

UnwrapPromise<T>: T extends PromiseLike<infer U> ? U : T

Unwrap Promise Generic Type

Type parameters

  • T

Values

Values<T>: T[keyof T][]

Convert values of object to array

Type parameters

  • T

Properties

default

default: { AsyncUtils: { LazyPromise: typeof LazyPromise; allSettled: <T>(collection: Promise<T>[]) => Promise<SettleResult<T>[]>; any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>; filter: <T>(collection: T[], predicate: AsyncFunction<[T, any, any], boolean>) => Promise<T[]>; map: { <T>(collection: T): Promise<Tuple<T>>; <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, Promise<R>>): Promise<R[]>; <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, Promise<R>>): Promise<R[]>; (collection: any, iteratee?: any): Promise<any[]> }; timeout: <T>(executor: PromiseExecutor<T>, timeout?: number) => Promise<T> }; BlockedQueue: typeof BlockedQueue; Mutex: typeof Mutex; Semaphore: typeof Semaphore; TimeoutError: typeof TimeoutError; add: <T>(augend: T, addend: T) => T; addPrefix: (str?: string, prefix?: string) => string; addSuffix: (str?: string, suffix?: string) => string; any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>; ary: (func: Function, n?: any, guard?: any) => Function; assign: (target: any, ...args: any[]) => any; assignIn: (target: any, ...args: any[]) => any; at: { (object: any, paths: number[]): any[]; (object: any, paths: string[]): any[]; (object: any, ...paths: number[]): any[]; (object: any, ...paths: string[]): any[]; (object: any, ...paths: any[]): any[] }; attempt: <T>(func: T, ...args: any[]) => ReturnType<T> | Error; bind: typeof bind; cacheIt: { <T>(obj: T, options?: CacheItOptions): CachedFunction<T>; <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>; <T>(obj: T, options?: CacheItOptions): CachedObject<T> }; cacheItTTL: { <T>(obj: T, options?: CacheItOptions): CachedFunction<T>; <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>; <T>(obj: T, options?: CacheItOptions): CachedObject<T>; (obj: any, options?: CacheItOptions): any }; cacheProvider: { LRUCacheProvider: typeof LRUCacheProvider; TTLCacheProvider: typeof TTLCacheProvider }; capitalize: (s: string) => string; ceil: (number: number, precision?: number) => number; chunk: <T>(array: T[], size?: number) => T[][]; clone: <T>(value: T) => T; cloneDeep: <T>(value: T) => T; closest: (input: string, dict: string[]) => string; concat: <T>(...arrays: T[] | T[][]) => T[]; concurrency: { any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>; debounce: <T>(runner: T, wait: number) => T; limit: <T>(runner: T, concurrencyNumber: number) => T; series: <T>(...asyncOperations: T) => Promise<SeriesResult<T>>; synchronized: <T>(func: T) => T; timeout: <T>(runner: T, timeout?: number) => T }; cond: <R>(pairs: [(...args: any[]) => boolean, (...args: any[]) => R][][]) => R; conforms: { <T>(source: { [ key in string | number | symbol]?: (value: any) => boolean }): (obj: T) => boolean; (source: any): any }; conformsTo: <T>(object: T, source: { [ key in string | number | symbol]?: (value: any) => boolean }) => boolean; constant: <T>(value?: T) => () => T; countBy: { <T>(collection: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, number>; <T>(collection: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, number> }; createTimeoutPromise: <T>(executor: PromiseExecutor<T>, timeout?: number) => Promise<T>; curry: { placeholder: string | symbol }; debounce: <F>(func: F, wait?: number, options?: Options) => DebouncedFunction<F>; defaultTo: <T>(value: any, defaultValue: T) => T; delay: <T>(func: T, wait?: number, ...args: Parameters<T>) => number; differenceBy: (array: any, ...values: any[]) => any; distance: (s1?: string, s2?: string) => number; divide: (dividend: number, divisor: number) => number; each: { <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void; <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void }; eq: (value: any, other: any) => boolean; escapeRegExp: (string: string) => string; every: (collection: object | any[], predicate?: Function, guard?: any) => boolean; everyValue: <T>(object: PlainObject<T>, predicate: CollectionIteratee<T, boolean>) => boolean; fallback: { cache: <T>(runner: T, cacheSize?: number) => T; circuit: <T>(runner: T, openDuration?: number, cacheSize?: number) => T; recommend: <T>(runner: T, options?: RecommendFallbackCreatorOptions) => T; retry: <T>(runner: T, maxRetryNumber?: number, retryAfterSeconds?: number) => T }; filter: { <T>(collection: T[], predicate?: Predicate<T>): T[]; <T>(collection: T[], predicate?: any): T[] }; filterObject: { <T>(object: Record<string, T>, predicate?: Predicate<string, T, Record<string, T>>): T[]; <T>(object: T[], predicate?: Predicate<string, T, T[]>): T[]; (object: any, predicate?: Predicate<any, any, any>): any[] }; find: { <T>(collection: ArrayLike<T>, predicate?: string, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: (item: T) => boolean, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: Partial<T>, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: any, fromIndex?: number): T | undefined }; first: <T>(array: ArrayLike<T>) => T | undefined; flatMap: { <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]; <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[] }; flatMapDeep: { <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]; <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[] }; flatten: (array: any[]) => any[]; flattenDeep: (array: any[]) => any[]; flip: <F>(func: F) => (...args: any[]) => ReturnType<F>; forEach: { <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void; <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void }; forOwn: <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>) => void; forOwnRight: <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>) => void; fromEntries: <T>(pairs: Entry<T>[]) => {}; functions: (object: any) => string[]; get: { (object: any, path: string[], defaultValue?: any): any; (object: any, path: string, defaultValue?: any): any }; groupBy: { <T, K>(result: Collection<T>): Record<string, T[]>; <T, K>(result: ArrayLike<T>, iteratee: KeyIteratee): Record<string, T[]>; <T, K>(result: Record<string, T>, iteratee: KeyIteratee): Record<string, T[]>; <T, K>(result: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, T[]>; <T, K>(result: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, T[]> }; has: (object: any, path: ArrayPath) => boolean; head: <T>(array: ArrayLike<T>) => T | undefined; includes: <T>(collection: ArrayLike<T> | Record<string, T>, value: T, fromIndex?: number, guard?: any) => boolean; initial: <T>(array: T[]) => T[]; intersection: <T>(...arrays: T[][]) => T[]; intersectionBy: <T>(...arrays: any[]) => T[]; intersectionWith: <T>(...arrays: any[]) => T[]; invert: <T>(object: T) => any; invertBy: <T>(object: Record<string, T>, iteratee: RecordIteratee<T, string>) => Record<string, string[]>; invoke: (object: any, path: any, ...args: any[]) => any; invokeMap: { (collection: Collection<any>, path: ArrayPath, ...args: any[]): any[]; <T, F>(collection: Collection<T>, path: F, ...args: Parameters<F>): ReturnType<F>[]; (collection: any, path?: any, ...args: any[]): any }; isArguments: (value: any) => boolean; isArray: (value: any) => value is any[]; isArrayLike: (value: any) => boolean; isCircular: (obj: any) => boolean; isDate: (value: any) => value is Date; isEmpty: (value?: any) => boolean; isEqual: (value: any, other: any) => boolean; isEqualWith: <V1, V2>(value: V1, other: V2, customizer?: (v1?: V1, v2?: V2) => boolean) => boolean; isError: (value: any) => value is Error; isFunction: (value: any) => value is Function; isInstance: <T>(inst: any, aClass: Class<T>) => inst is T; isMap: (value: any) => value is Map<any, any>; isNull: (value: any) => value is null; isNumber: (value: any) => value is number; isObject: (value: any) => boolean; isString: (value: any) => value is string; isSubClass: (subClass: Class<any>, parentClass: Class<any>) => boolean; join: (array: any[], separator?: string) => string; keys: (object: any) => string[]; last: <T>(array: ArrayLike<T>) => T; lastIndexOf: <T>(array: ArrayLike<T>, value: T, fromIndex: number) => number; logic: { allTrue: (...expressions: (boolean | BoolFunction)[]) => boolean; anyTrue: (...expressions: (boolean | BoolFunction)[]) => boolean; asyncAllTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean>; asyncAnyTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean> }; lowerCase: (str: string) => string; lt: <T>(value: T, other: T) => boolean; map: { <T>(collection: T): Tuple<T>; <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, R>): R[]; <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, R>): R[]; (collection: any, iteratee?: any): [] }; mapKeys: { <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject; <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject }; mapValues: { <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject; <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject }; matchesProperty: (path: ArrayPath, srcValue: any) => (object: any) => boolean; max: <T>(array: ArrayLike<T>) => T; maxBy: { <T>(array: ArrayLike<T>, iteratee?: any): T; (array: any, iteratee?: any): any }; mean: (array: number[]) => number; meanBy: <T>(array: T[], iteratee: ArrayIteratee<T, number>) => number; memoize: typeof memoize; merge: { <A, B, C, D>(target: A, s1: B, s2: C, s3: D): A & B & C & D; <A, B, C>(target: A, s1: B, s2: C): A & B & C; <A, B>(target: A, s1: B): A & B }; mergeWith: (object: any, ...sourcesOrCustomizer: any[]) => any; method: (path: ArrayPath, ...args: any[]) => any; methodOf: (object: any, ...args: any[]) => any; min: { <T>(array: ArrayLike<T>): T; (array: any): any }; minBy: <T>(array: ArrayLike<T>, iteratee?: any) => T; omit: <T>(object: T, ...paths: ArrayPath[]) => Partial<T>; over: (...iteratees: Function[]) => OverFunction; overArgs: (func: Function, transforms: Function[]) => Function; overEvery: (...iteratees: Function[]) => OverEveryFunction; overSome: (...iteratees: Function[]) => OverSomeFunction; pad: (string?: string, length?: number, chars?: string) => string; padEnd: (string?: string, length?: number, chars?: string) => string; padStart: (string?: string, length?: number, chars?: string) => string; partial: typeof partial; pick: (object: any, ...paths: Path[]) => any; pickBy: (object: any, predicate: (value: any) => boolean) => any; pull: <T>(array: T[], ...values: T[]) => T[]; pullAll: <T>(array: T[], values: T[]) => T[]; pullAllWith: <T>(array: T[], values: T[], comparator: Comparator<T>) => T[]; pullAt: <T>(array: T[], ...indexes: (string | number)[]) => T[]; random: { (floating?: boolean): number; (upper?: string | number, floating?: boolean): number; (lower?: string | number, upper?: string | number, floating?: boolean): number }; range: (start: number, end?: number, step?: number) => number[]; reduce: { <T, R>(collection?: Record<string, T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R; <T, R>(collection?: ArrayLike<T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R }; reject: <T>(collection: Collection<T>, predicate: CollectionIteratee<T, any>) => T[]; remove: <T>(array: ArrayLike<T>, predicate: CollectionIteratee<T, boolean>) => T[]; repeat: (str: string, n?: number, guard?: any) => string; replace: (...args: any[]) => string; retry: <T>(runner: T, maxRetryCount?: number, retryAfterMSecond?: number) => T; series: <T>(...asyncOperations: T) => Promise<SeriesResult<T>>; set: { (object: any, path: string[], value: any): any; (object: any, path: string, value: any): any }; size: { (collection: string): number; (collection: ArrayLike<any>): number; (collection: Record<string, any>): number; (collection: any): number }; sleep: (ms: number) => Promise<void>; slice: <T>(array: ArrayLike<T>, start?: number, end?: number) => T[]; some: <T>(collection: ArrayLike<T>, predicate?: any, guard?: any) => boolean; someValues: <T>(object: Record<string, T>, predicate: RecordIteratee<T, boolean>) => boolean; sortedIndex: <T>(array: T[], value: T) => number; sortedIndexBy: <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>) => number; sortedIndexOf: <T>(array: T[], value: T) => number; sortedLastIndex: <T>(array: T[], value: T) => number; sortedLastIndexBy: <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>) => number; sortedLastIndexOf: <T>(array: T[], value: T) => number; sortedUniq: <T>(array: T[]) => T[]; sortedUniqBy: <T>(array: T[], iteratee: ArrayIteratee<T, any>) => T[]; split: (str?: string, separator?: string | RegExp, limit?: number) => string[]; sum: (array: ArrayLike<number>) => number; sumBy: (array: any, iteratee: any) => number; take: <T>(array: ArrayLike<T>, n?: number, guard?: any) => T[]; takeRight: <T>(array: ArrayLike<T>, n?: number) => T[]; throttle: (func: (...args: any[]) => any, wait?: number, options?: { leading: boolean; trailing: boolean }) => DebouncedFunction<(...args: any[]) => any>; timeIt: { (fn: AsyncFunction<[], void>): Promise<number>; (fn: GeneralFunction<[], void>): number }; times: <T>(n: number, iteratee?: T) => ReturnType<T>; toArray: (value: any) => any; toLower: (value: string) => string; toNumber: (value: any) => number; toUpper: (value: string) => string; trim: (str: string, chars: string, guard?: any) => string; trimEnd: (str: string, chars: string, guard?: any) => string; trimPrefix: (str: string, prefix: string) => string; trimStart: (str: string, chars: string, guard?: any) => string; trimSuffix: (str: string, suffix: string) => string; unWrap: (inner: string, wrapper: string) => string; unionBy: <T>(...arrays: any[]) => T[]; uniq: { <T>(array: T[]): T[]; (array: any[]): any[] }; uniqBy: { <T>(array: T[], iteratee: KeyIteratee): T[]; <T>(array: T[], iteratee: ArrayIteratee<T, any>): T[] }; uniqWith: <T>(array: T[], comparator: Comparator<T>) => T[]; uniqueId: (prefix?: string) => string; unset: { <T>(object: T, path: string[]): T; <T>(object: T, path: string): T }; update: <U>(object: any, path: string | string[], updater?: U) => ReturnType<U>; values: <T>(object: T) => Values<T>; words: (string: string, pattern?: string | RegExp) => string[]; wrap: (inner: string, wrapper: string) => string }

Type declaration

  • AsyncUtils: { LazyPromise: typeof LazyPromise; allSettled: <T>(collection: Promise<T>[]) => Promise<SettleResult<T>[]>; any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>; filter: <T>(collection: T[], predicate: AsyncFunction<[T, any, any], boolean>) => Promise<T[]>; map: { <T>(collection: T): Promise<Tuple<T>>; <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, Promise<R>>): Promise<R[]>; <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, Promise<R>>): Promise<R[]>; (collection: any, iteratee?: any): Promise<any[]> }; timeout: <T>(executor: PromiseExecutor<T>, timeout?: number) => Promise<T> }
    • LazyPromise: typeof LazyPromise
    • allSettled: <T>(collection: Promise<T>[]) => Promise<SettleResult<T>[]>
        • <T>(collection: Promise<T>[]): Promise<SettleResult<T>[]>
        • Promise.allSettled() implementation

          author

          Theo Sun

          since

          5.18.0

          category

          Async

          Type parameters

          • T = any

          Parameters

          • collection: Promise<T>[]

          Returns Promise<SettleResult<T>[]>

    • any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>
        • <T>(iterable: Iterable<Promise<T>>): Promise<T>
        • Promise.any implementation

          just ref the MDN document

          Promise.any() takes an iterable of Promise objects and, as soon as one of the promises in the iterable fulfils, returns a single promise that resolves with the value from that promise. If no promises in the iterable fulfil (if all of the given promises are rejected), then throw the array of errors

          since

          5.7.0

          category

          Async

          throws

          Error list

          Type parameters

          • T

          Parameters

          • iterable: Iterable<Promise<T>>

          Returns Promise<T>

    • filter: <T>(collection: T[], predicate: AsyncFunction<[T, any, any], boolean>) => Promise<T[]>
        • <T>(collection: T[], predicate: AsyncFunction<[T, any, any], boolean>): Promise<T[]>
        • AsyncUtils.filter, filter values by async predicate function

          author

          Theo Sun

          since

          5.18.0

          category

          Async

          Type parameters

          • T: unknown

          Parameters

          • collection: T[]
          • predicate: AsyncFunction<[T, any, any], boolean>

            async predicate

          Returns Promise<T[]>

    • map: { <T>(collection: T): Promise<Tuple<T>>; <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, Promise<R>>): Promise<R[]>; <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, Promise<R>>): Promise<R[]>; (collection: any, iteratee?: any): Promise<any[]> }
        • <T>(collection: T): Promise<Tuple<T>>
        • <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, Promise<R>>): Promise<R[]>
        • <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, Promise<R>>): Promise<R[]>
        • (collection: any, iteratee?: any): Promise<any[]>
        • AsyncUtils.map, mapping values with async iteratee functions

          author

          Theo Sun

          since

          5.18.0

          category

          Async

          Type parameters

          • T: any[] | []

          Parameters

          • collection: T

          Returns Promise<Tuple<T>>

        • Type parameters

          • T

          • R = any

          Parameters

          • collection: ArrayLike<T>
          • Optional iteratee: ArrayIteratee<T, Promise<R>>

          Returns Promise<R[]>

        • Type parameters

          • T

          • R = any

          Parameters

          • collection: Record<string, T>
          • Optional iteratee: RecordIteratee<T, Promise<R>>

          Returns Promise<R[]>

        • Parameters

          • collection: any
          • Optional iteratee: any

          Returns Promise<any[]>

    • timeout: <T>(executor: PromiseExecutor<T>, timeout?: number) => Promise<T>
        • <T>(executor: PromiseExecutor<T>, timeout?: number): Promise<T>
        • create a promise with timeout, if time is up but no result/error resolved by promise, will throw an error

          category

          Async

          since

          5.14.0

          throws

          {TimeoutError}

          Type parameters

          • T

          Parameters

          • executor: PromiseExecutor<T>

            the promise executor

          • timeout: number = ...

            the timeout in milliseconds, e.g. 10000 means 10 seconds, and default value is 60 seconds

          Returns Promise<T>

  • BlockedQueue: typeof BlockedQueue
  • Mutex: typeof Mutex
  • Semaphore: typeof Semaphore
  • TimeoutError: typeof TimeoutError
  • add: <T>(augend: T, addend: T) => T
      • <T>(augend: T, addend: T): T
      • Adds two numbers.

        since

        5.3.0

        category

        Math

        example
        add(6, 4)
        // => 10
        add('6', '4')
        // => '64'

        Type parameters

        • T

        Parameters

        • augend: T

          The first number in an addition.

        • addend: T

          The second number in an addition.

        Returns T

        Returns the total.

  • addPrefix: (str?: string, prefix?: string) => string
      • (str?: string, prefix?: string): string
      • add prefix to string

        since

        5.14.0

        category

        String

        see

        addSuffix

        addPrefix("123456", "123")
        // => '123456'
        addPrefix("456", "123")
        // => '123456'

        Parameters

        • str: string = ''

          to be processed string

        • prefix: string = ''

          prefix string

        Returns string

  • addSuffix: (str?: string, suffix?: string) => string
      • (str?: string, suffix?: string): string
      • add suffix to string

        since

        5.14.0

        category

        String

        see

        addPrefix

        addSuffix("123456", "456")
        // => '123456'
        addSuffix("123", "123")
        // => '123456'

        Parameters

        • str: string = ''

          to be processed string

        • suffix: string = ''

          prefix string

        Returns string

  • any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>
      • <T>(iterable: Iterable<Promise<T>>): Promise<T>
      • Promise.any implementation

        just ref the MDN document

        Promise.any() takes an iterable of Promise objects and, as soon as one of the promises in the iterable fulfils, returns a single promise that resolves with the value from that promise. If no promises in the iterable fulfil (if all of the given promises are rejected), then throw the array of errors

        since

        5.7.0

        category

        Async

        throws

        Error list

        Type parameters

        • T

        Parameters

        • iterable: Iterable<Promise<T>>

        Returns Promise<T>

  • ary: (func: Function, n?: any, guard?: any) => Function
      • (func: Function, n?: any, guard?: any): Function
      • Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.

        since

        5.5.0

        category

        Function

        example
        map(['6', '8', '10'], ary(parseInt, 1));
        // => [6, 8, 10]

        Parameters

        • func: Function

          The function to cap arguments for.

        • n: any = ...

          The arity cap.

        • Optional guard: any

          Enables use as an iteratee for methods like map.

        Returns Function

        Returns the new capped function.

  • assign: (target: any, ...args: any[]) => any
      • (target: any, ...args: any[]): any
      • Assigns own enumerable string keyed properties of source objects to the destination object. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

        Note: This method mutates object and is loosely based on Object.assign.

        since

        5.5.0

        category

        Object

        see

        assignIn

        example
        function Foo() {
        this.a = 1;
        }

        function Bar() {
        this.c = 3;
        }

        Foo.prototype.b = 2;
        Bar.prototype.d = 4;

        assign({ 'a': 0 }, new Foo, new Bar);
        // => { 'a': 1, 'c': 3 }

        Parameters

        • target: any
        • Rest ...args: any[]

        Returns any

        Returns object.

  • assignIn: (target: any, ...args: any[]) => any
      • (target: any, ...args: any[]): any
      • This method is like assign except that it iterates over own and inherited source properties.

        Note: This method mutates object.

        since

        5.5.0

        alias

        extend

        category

        Object

        see

        assign

        example
        function Foo() {
        this.a = 1;
        }

        function Bar() {
        this.c = 3;
        }

        Foo.prototype.b = 2;
        Bar.prototype.d = 4;

        assignIn({ 'a': 0 }, new Foo, new Bar);
        // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }

        Parameters

        • target: any

          The destination object.

        • Rest ...args: any[]

        Returns any

        Returns object.

  • at: { (object: any, paths: number[]): any[]; (object: any, paths: string[]): any[]; (object: any, ...paths: number[]): any[]; (object: any, ...paths: string[]): any[]; (object: any, ...paths: any[]): any[] }
      • (object: any, paths: number[]): any[]
      • (object: any, paths: string[]): any[]
      • (object: any, ...paths: number[]): any[]
      • (object: any, ...paths: string[]): any[]
      • (object: any, ...paths: any[]): any[]
      • Creates an array of values corresponding to paths of object.

        since

        5.5.0

        category

        Object

        example
        const object = { 'a': [{ 'b': { 'c': 3 } }, 4] }

        at(object, ['a[0].b.c', 'a[1]'])
        // => [3, 4]

        Parameters

        • object: any

          The object to iterate over.

        • paths: number[]

          The property paths to pick.

        Returns any[]

        Returns the picked values.

      • Parameters

        • object: any
        • paths: string[]

        Returns any[]

      • Parameters

        • object: any
        • Rest ...paths: number[]

        Returns any[]

      • Parameters

        • object: any
        • Rest ...paths: string[]

        Returns any[]

      • Parameters

        • object: any
        • Rest ...paths: any[]

        Returns any[]

  • attempt: <T>(func: T, ...args: any[]) => ReturnType<T> | Error
      • <T>(func: T, ...args: any[]): ReturnType<T> | Error
      • Attempts to invoke func, returning either the result or the caught error object. Any additional arguments are provided to func when it's invoked.

        since

        5.3.0

        category

        Util

        example
        // Avoid throwing errors for invalid selectors.
        const elements = attempt(selector =>
        document.querySelectorAll(selector), '>_>')

        if (isError(elements)) {
        elements = []
        }

        Type parameters

        • T: (...args: any[]) => any

        Parameters

        • func: T

          The function to attempt.

        • Rest ...args: any[]

          The arguments to invoke func with.

        Returns ReturnType<T> | Error

        Returns the func result or error object.

  • bind: typeof bind
  • cacheIt: { <T>(obj: T, options?: CacheItOptions): CachedFunction<T>; <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>; <T>(obj: T, options?: CacheItOptions): CachedObject<T> }
      • <T>(obj: T, options?: CacheItOptions): CachedFunction<T>
      • <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>
      • <T>(obj: T, options?: CacheItOptions): CachedObject<T>
      • make all methods of object are cached

        since

        5.16.0

        category

        Util

        Type parameters

        Parameters

        • obj: T
        • Optional options: CacheItOptions

        Returns CachedFunction<T>

      • create a class wrapper, the instance created by that wrapper will automatically apply cacheIt

        since

        5.16.0

        Type parameters

        • T

        Parameters

        • obj: Class<T>
        • Optional options: CacheItOptions

        Returns CachedClass<T>

      • make function is cached, default with LRU container

        since

        5.16.0

        category

        Util

        Type parameters

        • T: object

        Parameters

        • obj: T
        • Optional options: CacheItOptions

        Returns CachedObject<T>

  • cacheItTTL: { <T>(obj: T, options?: CacheItOptions): CachedFunction<T>; <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>; <T>(obj: T, options?: CacheItOptions): CachedObject<T>; (obj: any, options?: CacheItOptions): any }
      • <T>(obj: T, options?: CacheItOptions): CachedFunction<T>
      • <T>(obj: Class<T>, options?: CacheItOptions): CachedClass<T>
      • <T>(obj: T, options?: CacheItOptions): CachedObject<T>
      • (obj: any, options?: CacheItOptions): any
      • Type parameters

        Parameters

        • obj: T
        • Optional options: CacheItOptions

        Returns CachedFunction<T>

      • Type parameters

        • T

        Parameters

        • obj: Class<T>
        • Optional options: CacheItOptions

        Returns CachedClass<T>

      • Type parameters

        • T: object

        Parameters

        • obj: T
        • Optional options: CacheItOptions

        Returns CachedObject<T>

      • Parameters

        • obj: any
        • Optional options: CacheItOptions

        Returns any

  • cacheProvider: { LRUCacheProvider: typeof LRUCacheProvider; TTLCacheProvider: typeof TTLCacheProvider }
    • LRUCacheProvider: typeof LRUCacheProvider
    • TTLCacheProvider: typeof TTLCacheProvider
  • capitalize: (s: string) => string
      • (s: string): string
      • Converts the first character of string to upper case and the remaining to lower case.

        since

        5.3.0

        category

        String

        example
        capitalize('FRED')
        // => 'Fred'

        Parameters

        • s: string

          The string to capitalize.

        Returns string

        Returns the capitalized string.

  • ceil: (number: number, precision?: number) => number
      • (number: number, precision?: number): number
      • Computes number rounded up to precision. (Round up: the smallest integer greater than or equal to a given number.)

        since

        5.5.0

        category

        Math

        example
        ceil(4.006)
        // => 5

        ceil(6.004, 2)
        // => 6.01

        ceil(6040, -2)
        // => 6100

        Parameters

        • number: number

          The number to round up.

        • precision: number = 0

          The precision to round up to.

        Returns number

        Returns the rounded up number.

  • chunk: <T>(array: T[], size?: number) => T[][]
      • <T>(array: T[], size?: number): T[][]
      • Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements.

        since

        5.18.0

        category

        Array

        example
        chunk(['a', 'b', 'c', 'd'], 2)
        // => [['a', 'b'], ['c', 'd']]

        chunk(['a', 'b', 'c', 'd'], 3)
        // => [['a', 'b', 'c'], ['d']]

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to process.

        • size: number = 1

          The length of each chunk, default is 1

        Returns T[][]

        Returns the new array of chunks.

  • clone: <T>(value: T) => T
      • <T>(value: T): T
      • Creates a shallow clone of value.

        Note: This method is loosely based on the structured clone algorithm and supports cloning arrays, array buffers, booleans, date objects, maps, numbers, Object objects, regexps, sets, strings, symbols, and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. Object inheritance is preserved. An empty object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps.

        since

        5.3.0

        category

        Lang

        see

        cloneDeep

        example
        const objects = [{ 'a': 1 }, { 'b': 2 }]

        const shallow = clone(objects)
        console.log(shallow[0] === objects[0])
        // => true

        Type parameters

        • T

        Parameters

        • value: T

          The value to clone.

        Returns T

        Returns the cloned value.

  • cloneDeep: <T>(value: T) => T
      • <T>(value: T): T
      • This method is like clone except that it recursively clones value. Object inheritance is preserved.

        since

        5.3.0

        category

        Lang

        see

        clone

        example
        const objects = [{ 'a': 1 }, { 'b': 2 }]

        const deep = cloneDeep(objects)
        console.log(deep[0] === objects[0])
        // => false

        Type parameters

        • T

        Parameters

        • value: T

          The value to recursively clone.

        Returns T

        Returns the deep cloned value.

  • closest: (input: string, dict: string[]) => string
      • (input: string, dict: string[]): string
      • get closest string from dict

        since

        5.16.0

        category

        string

        Parameters

        • input: string
        • dict: string[]
          const dict = ['hello', 'haha', 'mama', 'moment', 'world', 'latest'];

          expect(closest('h', dict)).toBe('haha');
          expect(closest('he', dict)).toBe('hello');
          expect(closest('m', dict)).toBe('mama');
          expect(closest('mo', dict)).toBe('mama');
          expect(closest('mome', dict)).toBe('mama');
          expect(closest('latast', dict)).toBe('latest');

        Returns string

  • concat: <T>(...arrays: T[] | T[][]) => T[]
      • <T>(...arrays: T[] | T[][]): T[]
      • Creates a new array concatenating array with any additional arrays and/or values.

        since

        5.0.0

        category

        Array

        example
        var array = [1];
        var other = concat(array, 2, [3], [[4]]);

        console.log(other);
        // => [1, 2, 3, [4]]

        console.log(array);
        // => [1]

        Type parameters

        • T

        Parameters

        • Rest ...arrays: T[] | T[][]

        Returns T[]

        Returns the new concatenated array.

  • concurrency: { any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>; debounce: <T>(runner: T, wait: number) => T; limit: <T>(runner: T, concurrencyNumber: number) => T; series: <T>(...asyncOperations: T) => Promise<SeriesResult<T>>; synchronized: <T>(func: T) => T; timeout: <T>(runner: T, timeout?: number) => T }
    • any: <T>(iterable: Iterable<Promise<T>>) => Promise<T>
        • <T>(iterable: Iterable<Promise<T>>): Promise<T>
        • Promise.any implementation

          just ref the MDN document

          Promise.any() takes an iterable of Promise objects and, as soon as one of the promises in the iterable fulfils, returns a single promise that resolves with the value from that promise. If no promises in the iterable fulfil (if all of the given promises are rejected), then throw the array of errors

          since

          5.7.0

          category

          Async

          throws

          Error list

          Type parameters

          • T

          Parameters

          • iterable: Iterable<Promise<T>>

          Returns Promise<T>

    • debounce: <T>(runner: T, wait: number) => T
        • <T>(runner: T, wait: number): T
        • concurrency simply debounce function it will create a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked

          since

          5.18.0

          category

          Async

          Type parameters

          Parameters

          • runner: T
          • wait: number

            wait milliseconds before last time invocation

          Returns T

    • limit: <T>(runner: T, concurrencyNumber: number) => T
        • <T>(runner: T, concurrencyNumber: number): T
        • limit concurrent for parallel operations

          category

          Async

          since

          5.15.0

          Type parameters

          Parameters

          • runner: T

            async operation function

          • concurrencyNumber: number

            max concurrency number

          Returns T

          the concurrency limited function wrapper

    • series: <T>(...asyncOperations: T) => Promise<SeriesResult<T>>
        • <T>(...asyncOperations: T): Promise<SeriesResult<T>>
        • run async operations one by one, serially

          and return the result array

          if any operation raise error, the following operations will not be executed

          since

          5.14.0

          category

          Async

          example
          const [res1, res2, res3] = await series(
          () => fetch(1),
          () => fetch(2),
          () => fetch(3)
          )

          Type parameters

          Parameters

          • Rest ...asyncOperations: T

            async operations

          Returns Promise<SeriesResult<T>>

    • synchronized: <T>(func: T) => T
        • <T>(func: T): T
        • let async function only invoke at once in same time

          category

          Async

          since

          5.20.0

          Type parameters

          Parameters

          • func: T

            the function to be processed

          Returns T

          the wrapped function instance

    • timeout: <T>(runner: T, timeout?: number) => T
        • <T>(runner: T, timeout?: number): T
        • wrap an async function with timeout

          since

          5.15.0

          category

          Async

          throws

          {TimeoutError}

          Type parameters

          Parameters

          • runner: T

            async runner please, otherwise the timeout is not meaningful

          • Optional timeout: number

            timeout threshold in milliseconds

          Returns T

  • cond: <R>(pairs: [(...args: any[]) => boolean, (...args: any[]) => R][][]) => R
      • <R>(pairs: [(...args: any[]) => boolean, (...args: any[]) => R][][]): R
      • Creates a function that iterates over pairs and invokes the corresponding function of the first predicate to return truthy. The predicate-function pairs are invoked with the this binding and arguments of the created function.

        since

        5.12.0

        category

        Util

        example
        const func = cond([
        [matches({ 'a': 1 }), () => 'matches A'],
        [conforms({ 'b': isNumber }), () => 'matches B'],
        [() => true, () => 'no match']
        ])

        func({ 'a': 1, 'b': 2 })
        // => 'matches A'

        func({ 'a': 0, 'b': 1 })
        // => 'matches B'

        func({ 'a': '1', 'b': '2' })
        // => 'no match'

        Type parameters

        • R = any

        Parameters

        • pairs: [(...args: any[]) => boolean, (...args: any[]) => R][][]

          The predicate-function pairs.

        Returns R

        Returns the new composite function.

  • conforms: { <T>(source: { [ key in string | number | symbol]?: (value: any) => boolean }): (obj: T) => boolean; (source: any): any }
      • <T>(source: { [ key in string | number | symbol]?: (value: any) => boolean }): (obj: T) => boolean
      • (source: any): any
      • Creates a function that invokes the predicate properties of source with the corresponding property values of a given object, returning true if all predicates return truthy, else false.

        Note: The created function is equivalent to conformsTo with source partially applied.

        since

        5.12.0

        category

        Util

        example
        const objects = [
        { 'a': 2, 'b': 1 },
        { 'a': 1, 'b': 2 }
        ]

        filter(objects, conforms({ 'b': function(n) { return n > 1 } }))
        // => [{ 'a': 1, 'b': 2 }]

        Type parameters

        • T: Record<string, any>

        Parameters

        • source: { [ key in string | number | symbol]?: (value: any) => boolean }

          The object of property predicates to conform to.

        Returns (obj: T) => boolean

        Returns the new spec function.

          • (obj: T): boolean
          • Creates a function that invokes the predicate properties of source with the corresponding property values of a given object, returning true if all predicates return truthy, else false.

            Note: The created function is equivalent to conformsTo with source partially applied.

            Parameters

            • obj: T

            Returns boolean

            Returns the new spec function.

      • Parameters

        • source: any

        Returns any

  • conformsTo: <T>(object: T, source: { [ key in string | number | symbol]?: (value: any) => boolean }) => boolean
      • <T>(object: T, source: { [ key in string | number | symbol]?: (value: any) => boolean }): boolean
      • Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.

        Note: This method is equivalent to conforms when source is partially applied.

        since

        5.12.0

        category

        Lang

        example
        const object = { 'a': 1, 'b': 2 }

        conformsTo(object, { 'b': function(n) { return n > 1 } })
        // => true

        conformsTo(object, { 'b': function(n) { return n > 2 } })
        // => false

        Type parameters

        • T: Record<string, any>

        Parameters

        • object: T

          The object to inspect.

        • source: { [ key in string | number | symbol]?: (value: any) => boolean }

          The object of property predicates to conform to.

        Returns boolean

        Returns true if object conforms, else false.

  • constant: <T>(value?: T) => () => T
      • <T>(value?: T): () => T
      • Creates a function that returns value.

        since

        5.0.0

        category

        Util

        example
        var objects = times(2, constant({ 'a': 1 }));

        console.log(objects);
        // => [{ 'a': 1 }, { 'a': 1 }]

        console.log(objects[0] === objects[1]);
        // => true

        Type parameters

        • T

        Parameters

        • Optional value: T

          The value to return from the new function.

        Returns () => T

        Returns the new constant function.

          • (): T
          • Creates a function that returns value.

            Returns T

            Returns the new constant function.

  • countBy: { <T>(collection: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, number>; <T>(collection: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, number> }
      • <T>(collection: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, number>
      • <T>(collection: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, number>
      • Creates an object composed of keys generated from the results of running each element of collection thru iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The iteratee is invoked with one argument: (value).

        since

        5.7.0

        category

        Collection

        example
        const users = [
        { 'user': 'barney', 'active': true },
        { 'user': 'betty', 'active': true },
        { 'user': 'fred', 'active': false }
        ]

        countBy(users, value => value.active);
        // => { 'true': 2, 'false': 1 }

        Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>

          The collection to iterate over.

        • iteratee: ArrayIteratee<T, any>

          The iteratee to transform keys.

        Returns Record<string, number>

        Returns the composed aggregate object.

      • Type parameters

        • T

        Parameters

        • collection: Record<string, T>
        • iteratee: RecordIteratee<T, any>

        Returns Record<string, number>

  • createTimeoutPromise: <T>(executor: PromiseExecutor<T>, timeout?: number) => Promise<T>
      • <T>(executor: PromiseExecutor<T>, timeout?: number): Promise<T>
      • create a promise with timeout, if time is up but no result/error resolved by promise, will throw an error

        category

        Async

        since

        5.14.0

        throws

        {TimeoutError}

        Type parameters

        • T

        Parameters

        • executor: PromiseExecutor<T>

          the promise executor

        • timeout: number = ...

          the timeout in milliseconds, e.g. 10000 means 10 seconds, and default value is 60 seconds

        Returns Promise<T>

  • curry: { placeholder: string | symbol }
      • <T>(func: T, arity?: number, guard?: any): CurriedFunction
      • Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

        Note: This method doesn't set the "length" property of curried functions.

        since

        5.5.0

        category

        Function

        example
        var abc = function(a, b, c) {
        return [a, b, c];
        };

        var curried = curry(abc);

        curried(1)(2)(3);
        // => [1, 2, 3]

        curried(1, 2)(3);
        // => [1, 2, 3]

        curried(1, 2, 3);
        // => [1, 2, 3]

        // Curried with placeholders.
        curried(1)(curry.placeholder, 3)(2);
        // => [1, 2, 3]

        Type parameters

        • T: Function = any

        Parameters

        • func: T

          The function to curry.

        • arity: number = ...

          The arity of func.

        • Optional guard: any

          Enables use as an iteratee for methods like map.

        Returns CurriedFunction

        Returns the new curried function.

    • placeholder: string | symbol
  • debounce: <F>(func: F, wait?: number, options?: Options) => DebouncedFunction<F>
      • <F>(func: F, wait?: number, options?: Options): DebouncedFunction<F>
      • Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked, or until the next browser frame is drawn. The debounced function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the debounced function. Subsequent calls to the debounced function return the result of the last func invocation.

        Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the debounced function is invoked more than once during the wait timeout.

        If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0.

        If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms).

        See David Corbacho's article for details over the differences between debounce and throttle.

        since

        5.3.0

        category

        Function

        example

        // Avoid costly calculations while the window size is in flux.
        jQuery(window).on('resize', debounce(calculateLayout, 150))

        // Invoke `sendMail` when clicked, debouncing subsequent calls.
        jQuery(element).on('click', debounce(sendMail, 300, {
        'leading': true,
        'trailing': false
        }))

        // Ensure `batchLog` is invoked once after 1 second of debounced calls.
        const debounced = debounce(batchLog, 250, { 'maxWait': 1000 })
        const source = new EventSource('/stream')
        jQuery(source).on('message', debounced)

        // Cancel the trailing debounced invocation.
        jQuery(window).on('popstate', debounced.cancel)

        // Check for pending invocations.
        const status = debounced.pending() ? "Pending..." : "Ready"

        Type parameters

        • F: (...args: any[]) => any

        Parameters

        • func: F

          The function to debounce.

        • Optional wait: number

          The number of milliseconds to delay; if omitted, requestAnimationFrame is used (if available).

        • Optional options: Options

          The options object.

        Returns DebouncedFunction<F>

        Returns the new debounced function.

  • defaultTo: <T>(value: any, defaultValue: T) => T
      • <T>(value: any, defaultValue: T): T
      • Checks value to determine whether a default value should be returned in its place. The defaultValue is returned if value is NaN, null, or undefined.

        since

        5.12.0

        category

        Util

        example
        defaultTo(1, 10)
        // => 1

        defaultTo(undefined, 10)
        // => 10

        Type parameters

        • T

        Parameters

        • value: any

          The value to check.

        • defaultValue: T

          The default value.

        Returns T

        Returns the resolved value.

  • delay: <T>(func: T, wait?: number, ...args: Parameters<T>) => number
      • <T>(func: T, wait?: number, ...args: Parameters<T>): number
      • Invokes func after wait milliseconds. Any additional arguments are provided to func when it's invoked.

        since

        5.7.0

        category

        Function

        example
        delay(text => console.log(text), 1000, 'later')
        // => Logs 'later' after one second.

        Type parameters

        • T: (...args: any[]) => any

        Parameters

        • func: T

          The function to delay.

        • wait: number = 0

          The number of milliseconds to delay invocation.

        • Rest ...args: Parameters<T>

          The arguments to invoke func with.

        Returns number

        Returns the timer id.

  • differenceBy: (array: any, ...values: any[]) => any
      • (array: any, ...values: any[]): any
      • This method is like difference except that it accepts iteratee which is invoked for each element of array and values to generate the criterion by which they're compared. The order and references of result values are determined by the first array. The iteratee is invoked with one argument: (value).

        Note: Unlike pullAllBy, this method returns a new array.

        since

        5.9.0

        category

        Array

        example
        _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
        // => [1.2]

        // The `_.property` iteratee shorthand.
        _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
        // => [{ 'x': 2 }]

        Parameters

        • array: any

          The array to inspect.

        • Rest ...values: any[]

          The values to exclude.

        Returns any

        Returns the new array of filtered values.

  • distance: (s1?: string, s2?: string) => number
      • (s1?: string, s2?: string): number
      • calculate distance of two string

        since

        5.16.0

        category

        String

        Parameters

        • s1: string = ''
        • s2: string = ''

        Returns number

  • divide: (dividend: number, divisor: number) => number
      • (dividend: number, divisor: number): number
      • Divide two numbers.

        since

        5.12.0

        category

        Math

        example
        divide(6, 4)
        // => 1.5

        Parameters

        • dividend: number

          The first number in a division.

        • divisor: number

          The second number in a division.

        Returns number

        Returns the quotient.

  • each: { <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void; <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void }
      • <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void
      • <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void
      • Iterates over elements of collection and invokes iteratee for each element. The iteratee is invoked with three arguments: (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.

        Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To avoid this behavior use forIn or forOwn for object iteration.

        since

        5.0.0

        alias

        each

        category

        Collection

        see

        [[forEachRight]],[[forIn]],[[forInRight]],forOwn,forOwnRight

        example
        forEach([1, 2], value => console.log(value))
        // => Logs `1` then `2`.

        forEach({ 'a': 1, 'b': 2 }, (value, key) => console.log(key))
        // => Logs 'a' then 'b' (iteration order is not guaranteed).

        Type parameters

        • T

        Parameters

        • Optional collection: ArrayLike<T>

          The collection to iterate over.

        • Optional iteratee: ArrayIteratee<T, void>

          The function invoked per iteration.

        Returns void

        Returns collection.

      • Type parameters

        • T

        Parameters

        • Optional collection: PlainObject<T>
        • Optional iteratee: RecordIteratee<T, void>

        Returns void

  • eq: (value: any, other: any) => boolean
      • (value: any, other: any): boolean
      • Performs a SameValueZero comparison between two values to determine if they are equivalent.

        since

        5.5.0

        category

        Lang

        example
        const object = { 'a': 1 }
        const other = { 'a': 1 }

        eq(object, object)
        // => true

        eq(object, other)
        // => false

        eq('a', 'a')
        // => true

        eq('a', Object('a'))
        // => false

        eq(NaN, NaN)
        // => true

        Parameters

        • value: any

          The value to compare.

        • other: any

          The other value to compare.

        Returns boolean

        Returns true if the values are equivalent, else false.

  • escapeRegExp: (string: string) => string
      • (string: string): string
      • Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string.

        since

        5.12.0

        category

        String

        see

        [[escape]], escapeRegExp, [[unescape]]

        example
        escapeRegExp('[lodash](https://lodash.com/)')
        // => '\[lodash\]\(https://lodash\.com/\)'

        Parameters

        • string: string

          The string to escape.

        Returns string

        string Returns the escaped string.

  • every: (collection: object | any[], predicate?: Function, guard?: any) => boolean
      • (collection: object | any[], predicate?: Function, guard?: any): boolean
      • Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate returns falsey. The predicate is invoked with three arguments: (value, index|key, collection).

        Note: This method returns true for empty collections because everything is true of elements of empty collections.

        since

        5.3.0

        category

        Collection

        example
        every([true, 1, null, 'yes'], Boolean);
        // => false

        var users = [
        { 'user': 'barney', 'age': 36, 'active': false },
        { 'user': 'fred', 'age': 40, 'active': false }
        ];

        // The `matches` iteratee shorthand.
        every(users, { 'user': 'barney', 'active': false });
        // => false

        // The `matchesProperty` iteratee shorthand.
        every(users, ['active', false]);
        // => true

        // The `property` iteratee shorthand.
        every(users, 'active');
        // => false

        Parameters

        • collection: object | any[]

          The collection to iterate over.

        • Optional predicate: Function

          The function invoked per iteration.

        • Optional guard: any

          Enables use as an iteratee for methods like map.

        Returns boolean

        Returns true if all elements pass the predicate check, else false.

  • everyValue: <T>(object: PlainObject<T>, predicate: CollectionIteratee<T, boolean>) => boolean
      • <T>(object: PlainObject<T>, predicate: CollectionIteratee<T, boolean>): boolean
      • Checks if predicate returns truthy for all properties of object. Iteration is stopped once predicate returns falsey. The predicate is invoked with three arguments: (value, key, object).

        Note: This method returns true for empty objects because everything is true of elements of empty objects.

        since

        5.11.0

        category

        Object

        example
        everyValue({ 'a': 0, 'b': 'yes', 'c': false }, Boolean)
        // => false

        Type parameters

        • T

        Parameters

        • object: PlainObject<T>

          The object to iterate over.

        • predicate: CollectionIteratee<T, boolean>

          The function invoked per iteration.

        Returns boolean

        Returns true if all properties pass the predicate check, else false.

  • fallback: { cache: <T>(runner: T, cacheSize?: number) => T; circuit: <T>(runner: T, openDuration?: number, cacheSize?: number) => T; recommend: <T>(runner: T, options?: RecommendFallbackCreatorOptions) => T; retry: <T>(runner: T, maxRetryNumber?: number, retryAfterSeconds?: number) => T }
    • cache: <T>(runner: T, cacheSize?: number) => T
        • <T>(runner: T, cacheSize?: number): T
        • fallback to cache, if runner throw error, will try to return the latest cached value

          since

          5.15.0

          category

          Fallback

          Type parameters

          • T

          Parameters

          • runner: T
          • cacheSize: number = 1024

            the maximum number cache item (different parameters)

          Returns T

    • circuit: <T>(runner: T, openDuration?: number, cacheSize?: number) => T
        • <T>(runner: T, openDuration?: number, cacheSize?: number): T
        • fallback to circuit

          will directly raise error [[TemporaryUnAvailableError]] when some error happened before in duration

          category

          Fallback

          Type parameters

          • T

          Parameters

          • runner: T
          • openDuration: number = ...

            default is 10000 (10 seconds)

          • cacheSize: number = 1024

            the timer & error cache size, default is 1024

          Returns T

    • recommend: <T>(runner: T, options?: RecommendFallbackCreatorOptions) => T
        • <T>(runner: T, options?: RecommendFallbackCreatorOptions): T
        • recommend fallback policy

          cache <- circuit <- retry <- runner

          when error happened from runner, retry it firstly

          if retry finally failed, the circuit breaker will open, later requests in a duration will not be executed, and just throw the temp not available error

          if the circuit is open, cache will catch the error, and try to get value from previous successful cache

          if there is no successful cache before, throw the original error (maybe wrapper with [[TemporaryUnAvailableError]]) directly

          since

          5.15.0

          category

          Fallback

          Type parameters

          Parameters

          • runner: T
          • options: RecommendFallbackCreatorOptions = {}

          Returns T

    • retry: <T>(runner: T, maxRetryNumber?: number, retryAfterSeconds?: number) => T
        • <T>(runner: T, maxRetryNumber?: number, retryAfterSeconds?: number): T
        • fallback to retry

          since

          5.15.0

          category

          Fallback

          Type parameters

          • T

          Parameters

          • runner: T

            async function, return promise

          • maxRetryNumber: number = 3

            the maximum number of times a runner should retry, default is 3

          • Optional retryAfterSeconds: number

          Returns T

  • filter: { <T>(collection: T[], predicate?: Predicate<T>): T[]; <T>(collection: T[], predicate?: any): T[] }
      • <T>(collection: T[], predicate?: Predicate<T>): T[]
      • <T>(collection: T[], predicate?: any): T[]
      • Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The predicate is invoked with three arguments: (value, index|key, collection).

        Note: Unlike remove, this method returns a new array.

        since

        5.0.0

        category

        Collection

        see

        reject

        example
        var users = [
        { 'user': 'barney', 'age': 36, 'active': true },
        { 'user': 'fred', 'age': 40, 'active': false }
        ];

        filter(users, function(o) { return !o.active; });
        // => objects for ['fred']

        // The `matches` iteratee shorthand.
        filter(users, { 'age': 36, 'active': true });
        // => objects for ['barney']

        // The `matchesProperty` iteratee shorthand.
        filter(users, ['active', false]);
        // => objects for ['fred']

        // The `property` iteratee shorthand.
        filter(users, 'active');
        // => objects for ['barney']

        Type parameters

        • T

        Parameters

        • collection: T[]

          The collection to iterate over.

        • Optional predicate: Predicate<T>

          The function invoked per iteration.

        Returns T[]

        Returns the new filtered array.

      • Type parameters

        • T

        Parameters

        • collection: T[]
        • Optional predicate: any

        Returns T[]

  • filterObject: { <T>(object: Record<string, T>, predicate?: Predicate<string, T, Record<string, T>>): T[]; <T>(object: T[], predicate?: Predicate<string, T, T[]>): T[]; (object: any, predicate?: Predicate<any, any, any>): any[] }
      • <T>(object: Record<string, T>, predicate?: Predicate<string, T, Record<string, T>>): T[]
      • <T>(object: T[], predicate?: Predicate<string, T, T[]>): T[]
      • (object: any, predicate?: Predicate<any, any, any>): any[]
      • Iterates over properties of object, returning an array of all elements predicate returns truthy for. The predicate is invoked with three arguments: (value, key, object).

        If you want an object in return, consider pickBy.

        since

        5.3.0

        category

        Object

        see

        pickBy,pull,pullAll,[[pullAllBy]],pullAllWith,pullAt,remove,reject

        example
        const object = { 'a': 5, 'b': 8, 'c': 10 }

        filterObject(object, (n) => !(n % 5))
        // => [5, 10]

        Type parameters

        • T

        Parameters

        • object: Record<string, T>

          The object to iterate over.

        • Optional predicate: Predicate<string, T, Record<string, T>>

          The function invoked per iteration.

        Returns T[]

        Returns the new filtered array.

      • Type parameters

        • T

        Parameters

        • object: T[]
        • Optional predicate: Predicate<string, T, T[]>

        Returns T[]

      • Parameters

        • object: any
        • Optional predicate: Predicate<any, any, any>

        Returns any[]

  • find: { <T>(collection: ArrayLike<T>, predicate?: string, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: (item: T) => boolean, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: Partial<T>, fromIndex?: number): T | undefined; <T>(collection: ArrayLike<T>, predicate?: any, fromIndex?: number): T | undefined }
      • <T>(collection: ArrayLike<T>, predicate?: string, fromIndex?: number): T | undefined
      • <T>(collection: ArrayLike<T>, predicate?: (item: T) => boolean, fromIndex?: number): T | undefined
      • <T>(collection: ArrayLike<T>, predicate?: Partial<T>, fromIndex?: number): T | undefined
      • <T>(collection: ArrayLike<T>, predicate?: any, fromIndex?: number): T | undefined
      • Iterates over elements of collection, returning the first element predicate returns truthy for. The predicate is invoked with three arguments: (value, index|key, collection).

        since

        5.2.0

        category

        Collection

        example
        var users = [
        { 'user': 'barney', 'age': 36, 'active': true },
        { 'user': 'fred', 'age': 40, 'active': false },
        { 'user': 'pebbles', 'age': 1, 'active': true }
        ];

        find(users, function(o) { return o.age < 40; });
        // => object for 'barney'

        // The `matches` iteratee shorthand.
        find(users, { 'age': 1, 'active': true });
        // => object for 'pebbles'

        // The `matchesProperty` iteratee shorthand.
        find(users, ['active', false]);
        // => object for 'fred'

        // The `property` iteratee shorthand.
        find(users, 'active');
        // => object for 'barney'

        Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>

          The collection to inspect.

        • Optional predicate: string

          function invoked per iteration.

        • Optional fromIndex: number

          The index to search from.

        Returns T | undefined

        Returns the matched element, else undefined.

      • Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>
        • Optional predicate: (item: T) => boolean
            • (item: T): boolean
            • Parameters

              • item: T

              Returns boolean

        • Optional fromIndex: number

        Returns T | undefined

      • Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>
        • Optional predicate: Partial<T>
        • Optional fromIndex: number

        Returns T | undefined

      • Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>
        • Optional predicate: any
        • Optional fromIndex: number

        Returns T | undefined

  • first: <T>(array: ArrayLike<T>) => T | undefined
      • <T>(array: ArrayLike<T>): T | undefined
      • Gets the first element of array.

        since

        5.5.0

        category

        Array

        see

        head

        example
        first([1, 2, 3]);
        // => 1

        first([]);
        // => undefined

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to query.

        Returns T | undefined

        Returns the first element of array.

  • flatMap: { <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]; <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[] }
      • <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]
      • <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[]
      • Creates a flattened array of values by running each element in collection thru iteratee and flattening the mapped results. The iteratee is invoked with three arguments: (value, index|key, collection).

        since

        5.4.0

        category

        Collection

        see

        flatMapDeep,[[flatMapDepth]],flatten,flattenDeep,[[flattenDepth]],map,mapKeys,mapValues

        example
        function duplicate(n) {
        return [n, n]
        }

        flatMap([1, 2], duplicate)
        // => [1, 1, 2, 2]

        Type parameters

        • T

        • R = any

        Parameters

        • collection: T[]

          The collection to iterate over.

        • Optional iteratee: Iteratee<number, T, T[]>

          The function invoked per iteration.

        Returns R[]

        Returns the new flattened array.

      • Type parameters

        • T

        • R = any

        Parameters

        • collection: Record<string, T>
        • Optional iteratee: Iteratee<string, T, Record<string, T>>

        Returns R[]

  • flatMapDeep: { <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]; <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[] }
      • <T, R>(collection: T[], iteratee?: Iteratee<number, T, T[]>): R[]
      • <T, R>(collection: Record<string, T>, iteratee?: Iteratee<string, T, Record<string, T>>): R[]
      • This method is like flatMap except that it recursively flattens the mapped results.

        since

        5.4.0

        category

        Collection

        see

        flatMap,[[flatMapDepth]],flatten,flattenDeep,[[flattenDepth]],map,mapKeys,mapValues

        example
        function duplicate(n) {
        return [[[n, n]]]
        }

        flatMapDeep([1, 2], duplicate)
        // => [1, 1, 2, 2]

        Type parameters

        • T

        • R = any

        Parameters

        • collection: T[]

          The collection to iterate over.

        • Optional iteratee: Iteratee<number, T, T[]>

          The function invoked per iteration.

        Returns R[]

        Returns the new flattened array.

      • Type parameters

        • T

        • R = any

        Parameters

        • collection: Record<string, T>
        • Optional iteratee: Iteratee<string, T, Record<string, T>>

        Returns R[]

  • flatten: (array: any[]) => any[]
      • (array: any[]): any[]
      • Flattens array a single level deep.

        since

        5.4.0

        category

        Array

        see

        flatMap,flatMapDeep,[[flatMapDepth]],flattenDeep,[[flattenDepth]]

        example
        flatten([1, [2, [3, [4]], 5]])
        // => [1, 2, [3, [4]], 5]

        Parameters

        • array: any[]

        Returns any[]

        Returns the new flattened array.

  • flattenDeep: (array: any[]) => any[]
      • (array: any[]): any[]
      • Recursively flattens array.

        since

        5.4.0

        category

        Array

        see

        flatMap,flatMapDeep,[[flatMapDepth]],flatten,[[flattenDepth]]

        example
        flattenDeep([1, [2, [3, [4]], 5]])
        // => [1, 2, 3, 4, 5]

        Parameters

        • array: any[]

          The array to flatten.

        Returns any[]

        Returns the new flattened array.

  • flip: <F>(func: F) => (...args: any[]) => ReturnType<F>
      • <F>(func: F): (...args: any[]) => ReturnType<F>
      • Creates a function that invokes func with arguments reversed.

        since

        5.12.0

        category

        Function

        see

        [[reverse]]

        example
        const flipped = flip((...args) => args)

        flipped('a', 'b', 'c', 'd')
        // => ['d', 'c', 'b', 'a']

        Type parameters

        • F: (...args: any[]) => any

        Parameters

        • func: F

          The function to flip arguments for.

        Returns (...args: any[]) => ReturnType<F>

        Returns the new flipped function.

          • (...args: any[]): ReturnType<F>
          • Creates a function that invokes func with arguments reversed.

            Parameters

            • Rest ...args: any[]

            Returns ReturnType<F>

            Returns the new flipped function.

  • forEach: { <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void; <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void }
      • <T>(collection?: ArrayLike<T>, iteratee?: ArrayIteratee<T, void>): void
      • <T>(collection?: PlainObject<T>, iteratee?: RecordIteratee<T, void>): void
      • Iterates over elements of collection and invokes iteratee for each element. The iteratee is invoked with three arguments: (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.

        Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To avoid this behavior use forIn or forOwn for object iteration.

        since

        5.0.0

        alias

        each

        category

        Collection

        see

        [[forEachRight]],[[forIn]],[[forInRight]],forOwn,forOwnRight

        example
        forEach([1, 2], value => console.log(value))
        // => Logs `1` then `2`.

        forEach({ 'a': 1, 'b': 2 }, (value, key) => console.log(key))
        // => Logs 'a' then 'b' (iteration order is not guaranteed).

        Type parameters

        • T

        Parameters

        • Optional collection: ArrayLike<T>

          The collection to iterate over.

        • Optional iteratee: ArrayIteratee<T, void>

          The function invoked per iteration.

        Returns void

        Returns collection.

      • Type parameters

        • T

        Parameters

        • Optional collection: PlainObject<T>
        • Optional iteratee: RecordIteratee<T, void>

        Returns void

  • forOwn: <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>) => void
      • <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>): void
      • Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. The iteratee is invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

        since

        5.11.0

        category

        Object

        see

        forEach, forEachRight, forIn, forInRight, forOwnRight

        example
        function Foo() {
        this.a = 1
        this.b = 2
        }

        Foo.prototype.c = 3

        forOwn(new Foo, function(value, key) {
        console.log(key)
        })
        // => Logs 'a' then 'b' (iteration order is not guaranteed).

        Type parameters

        • T

        Parameters

        • object: PlainObject<T>

          The object to iterate over.

        • iteratee: CollectionIteratee<T, void>

          The function invoked per iteration.

        Returns void

        Returns object.

  • forOwnRight: <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>) => void
      • <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, void>): void
      • This method is like forOwn except that it iterates over properties of object in the opposite order.

        since

        5.11.0

        category

        Object

        see

        forEach, [[forEachRight]], [[forIn]], [[forInRight]], forOwn

        example
        function Foo() {
        this.a = 1
        this.b = 2
        }

        Foo.prototype.c = 3

        forOwnRight(new Foo, function(value, key) {
        console.log(key)
        })
        // => Logs 'b' then 'a' assuming `forOwn` logs 'a' then 'b'.

        Type parameters

        • T

        Parameters

        • object: PlainObject<T>

          The object to iterate over.

        • iteratee: CollectionIteratee<T, void>

          The function invoked per iteration.

        Returns void

        Returns object.

  • fromEntries: <T>(pairs: Entry<T>[]) => {}
      • <T>(pairs: Entry<T>[]): {}
      • The inverse of entriesis method returns an object composed from key-value pairs.

        since

        5.10.0

        category

        Array

        example
        fromEntries([['a', 1], ['b', 2]])
        // => { 'a': 1, 'b': 2 }

        Type parameters

        • T

        Parameters

        • pairs: Entry<T>[]

          The key-value pairs.

        Returns {}

        Returns the new object.

        • [key: string]: T
  • functions: (object: any) => string[]
      • (object: any): string[]
      • Creates an array of function property names from own enumerable properties of object.

        since

        5.12.0

        category

        Object

        see

        [[functionsIn]]

        example
        function Foo() {
        this.a = () => 'a'
        this.b = () => 'b'
        }

        Foo.prototype.c = () => 'c'

        functions(new Foo)
        // => ['a', 'b']

        Parameters

        • object: any

          The object to inspect.

        Returns string[]

        Returns the function names.

  • get: { (object: any, path: string[], defaultValue?: any): any; (object: any, path: string, defaultValue?: any): any }
      • (object: any, path: string[], defaultValue?: any): any
      • (object: any, path: string, defaultValue?: any): any
      • Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.

        since

        5.3.0

        category

        Object

        see

        has, hasIn, set, unset

        example
        const object = { 'a': [{ 'b': { 'c': 3 } }] }

        get(object, 'a[0].b.c')
        // => 3

        get(object, ['a', '0', 'b', 'c'])
        // => 3

        get(object, 'a.b.c', 'default')
        // => 'default'

        Parameters

        • object: any

          The object to query.

        • path: string[]

          The path of the property to get.

        • Optional defaultValue: any

          The value returned for undefined resolved values.

        Returns any

        Returns the resolved value.

      • Parameters

        • object: any
        • path: string
        • Optional defaultValue: any

        Returns any

  • groupBy: { <T, K>(result: Collection<T>): Record<string, T[]>; <T, K>(result: ArrayLike<T>, iteratee: KeyIteratee): Record<string, T[]>; <T, K>(result: Record<string, T>, iteratee: KeyIteratee): Record<string, T[]>; <T, K>(result: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, T[]>; <T, K>(result: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, T[]> }
      • <T, K>(result: Collection<T>): Record<string, T[]>
      • <T, K>(result: ArrayLike<T>, iteratee: KeyIteratee): Record<string, T[]>
      • <T, K>(result: Record<string, T>, iteratee: KeyIteratee): Record<string, T[]>
      • <T, K>(result: ArrayLike<T>, iteratee: ArrayIteratee<T, any>): Record<string, T[]>
      • <T, K>(result: Record<string, T>, iteratee: RecordIteratee<T, any>): Record<string, T[]>
      • Creates an object composed of keys generated from the results of running each element of collection thru iteratee. The order of grouped values is determined by the order they occur in collection. The corresponding value of each key is an array of elements responsible for generating the key. The iteratee is invoked with one argument: (value).

        since

        5.5.0

        category

        Collection

        example
        groupBy([6.1, 4.2, 6.3], Math.floor);
        // => { '4': [4.2], '6': [6.1, 6.3] }

        // The `property` iteratee shorthand.
        groupBy(['one', 'two', 'three'], 'length');
        // => { '3': ['one', 'two'], '5': ['three'] }

        Type parameters

        • T

        • K

        Parameters

        • result: Collection<T>

        Returns Record<string, T[]>

        Returns the composed aggregate object.

      • Type parameters

        • T

        • K

        Parameters

        • result: ArrayLike<T>
        • iteratee: KeyIteratee

        Returns Record<string, T[]>

      • Type parameters

        • T

        • K

        Parameters

        • result: Record<string, T>
        • iteratee: KeyIteratee

        Returns Record<string, T[]>

      • Type parameters

        • T

        • K

        Parameters

        • result: ArrayLike<T>
        • iteratee: ArrayIteratee<T, any>

        Returns Record<string, T[]>

      • Type parameters

        • T

        • K

        Parameters

        • result: Record<string, T>
        • iteratee: RecordIteratee<T, any>

        Returns Record<string, T[]>

  • has: (object: any, path: ArrayPath) => boolean
      • (object: any, path: ArrayPath): boolean
      • Checks if key is a direct property of object.

        since

        5.3.0

        category

        Object

        see

        [[hasIn]],[[hasPath]],[[hasPathIn]]

        example
        const object = { 'a': { 'b': 2 } }
        const other = create({ 'a': create({ 'b': 2 }) })

        has(object, 'a')
        // => true

        has(other, 'a')
        // => false

        Parameters

        • object: any

          The object to query.

        • path: ArrayPath

          The key to check.

        Returns boolean

        Returns true if key exists, else false.

  • head: <T>(array: ArrayLike<T>) => T | undefined
      • <T>(array: ArrayLike<T>): T | undefined
      • Gets the first element of array.

        since

        5.0.0

        alias

        first

        category

        Array

        see

        last

        example
        head([1, 2, 3])
        // => 1

        head([])
        // => undefined

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to query.

        Returns T | undefined

        Returns the first element of array.

  • includes: <T>(collection: ArrayLike<T> | Record<string, T>, value: T, fromIndex?: number, guard?: any) => boolean
      • <T>(collection: ArrayLike<T> | Record<string, T>, value: T, fromIndex?: number, guard?: any): boolean
      • Checks if value is in collection. If collection is a string, it's checked for a substring of value, otherwise SameValueZero is used for equality comparisons. If fromIndex is negative, it's used as the offset from the end of collection.

        since

        5.12.0

        category

        Collection

        param-

        {Object} [guard] Enables use as an iteratee for methods like reduce.

        example
        includes([1, 2, 3], 1);
        // => true

        includes([1, 2, 3], 1, 2);
        // => false

        includes({ 'a': 1, 'b': 2 }, 1);
        // => true

        includes('abcd', 'bc');
        // => true

        Type parameters

        • T = any

        Parameters

        • collection: ArrayLike<T> | Record<string, T>

          The collection to inspect.

        • value: T

          The value to search for.

        • Optional fromIndex: number
        • Optional guard: any

        Returns boolean

        Returns true if value is found, else false.

  • initial: <T>(array: T[]) => T[]
      • <T>(array: T[]): T[]
      • Gets all but the last element of array.

        since

        5.18.0

        category

        Array

        example
        initial([1, 2, 3])
        // => [1, 2]

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The array to query.

        Returns T[]

        Returns the slice of array.

  • intersection: <T>(...arrays: T[][]) => T[]
      • <T>(...arrays: T[][]): T[]
      • Creates an array of unique values that are included in all given arrays using SameValueZero for equality comparisons. The order and references of result values are determined by the first array.

        since

        5.11.0

        category

        Array

        example
        intersection([2, 1], [2, 3])
        // => [2]

        Type parameters

        • T = any

        Parameters

        • Rest ...arrays: T[][]

          The arrays to inspect.

        Returns T[]

        Returns the new array of intersecting values.

  • intersectionBy: <T>(...arrays: any[]) => T[]
      • <T>(...arrays: any[]): T[]
      • This method is like intersection except that it accepts iteratee which is invoked for each element of each arrays to generate the criterion by which they're compared. The order and references of result values are determined by the first array. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Array

        example
        intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor)
        // => [2.1]

        Type parameters

        • T

        Parameters

        • Rest ...arrays: any[]

          The arrays to inspect.

        Returns T[]

        Returns the new array of intersecting values.

  • intersectionWith: <T>(...arrays: any[]) => T[]
      • <T>(...arrays: any[]): T[]
      • This method is like intersection except that it accepts comparator which is invoked to compare elements of arrays. The order and references of result values are determined by the first array. The comparator is invoked with two arguments: (arrVal, othVal).

        since

        5.11.0

        category

        Array

        example
        const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
        const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]

        intersectionWith(objects, others, isEqual)
        // => [{ 'x': 1, 'y': 2 }]

        Type parameters

        • T

        Parameters

        • Rest ...arrays: any[]

          The arrays to inspect.

        Returns T[]

        Returns the new array of intersecting values.

  • invert: <T>(object: T) => any
      • <T>(object: T): any
      • Creates an object composed of the inverted keys and values of object. If object contains duplicate values, subsequent values overwrite property assignments of previous values.

        since

        5.7.0

        category

        Object

        example
        const object = { 'a': 1, 'b': 2, 'c': 1 }

        invert(object)
        // => { '1': 'c', '2': 'b' }

        Type parameters

        • T

        Parameters

        • object: T

          The object to invert.

        Returns any

        Returns the new inverted object.

  • invertBy: <T>(object: Record<string, T>, iteratee: RecordIteratee<T, string>) => Record<string, string[]>
      • <T>(object: Record<string, T>, iteratee: RecordIteratee<T, string>): Record<string, string[]>
      • This method is like invert except that the inverted object is generated from the results of running each element of object thru iteratee. The corresponding inverted value of each inverted key is an array of keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Object

        example
        const object = { 'a': 1, 'b': 2, 'c': 1 }

        invertBy(object, value => `group${value}`)
        // => { 'group1': ['a', 'c'], 'group2': ['b'] }

        Type parameters

        • T = any

        Parameters

        • object: Record<string, T>

          The object to invert.

        • iteratee: RecordIteratee<T, string>

          The iteratee invoked per element.

        Returns Record<string, string[]>

        Returns the new inverted object.

  • invoke: (object: any, path: any, ...args: any[]) => any
      • (object: any, path: any, ...args: any[]): any
      • Invokes the method at path of object.

        since

        5.7.0

        category

        Object

        example
        const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }

        invoke(object, 'a[0].b.c.slice', [1, 3])
        // => [2, 3]

        Parameters

        • object: any

          The object to query.

        • path: any

          The path of the method to invoke.

        • Rest ...args: any[]

          The arguments to invoke the method with.

        Returns any

        Returns the result of the invoked method.

  • invokeMap: { (collection: Collection<any>, path: ArrayPath, ...args: any[]): any[]; <T, F>(collection: Collection<T>, path: F, ...args: Parameters<F>): ReturnType<F>[]; (collection: any, path?: any, ...args: any[]): any }
      • (collection: Collection<any>, path: ArrayPath, ...args: any[]): any[]
      • <T, F>(collection: Collection<T>, path: F, ...args: Parameters<F>): ReturnType<F>[]
      • (collection: any, path?: any, ...args: any[]): any
      • Invokes the method at path of each element in collection, returning an array of the results of each invoked method. Any additional arguments are provided to each invoked method. If path is a function, it's invoked for, and this bound to, each element in collection.

        since

        5.12.0

        category

        Collection

        example
        invokeMap([[5, 1, 7], [3, 2, 1]], 'sort')
        // => [[1, 5, 7], [1, 2, 3]]

        invokeMap([123, 456], String.prototype.split, [''])
        // => [['1', '2', '3'], ['4', '5', '6']]

        Parameters

        • collection: Collection<any>

          The collection to iterate over.

        • path: ArrayPath

          The path of the method to invoke or the function invoked per iteration.

        • Rest ...args: any[]

          The arguments to invoke each method with.

        Returns any[]

        Returns the array of results.

      • Type parameters

        • T

        • F: (...args: any[]) => any

        Parameters

        • collection: Collection<T>
        • path: F
        • Rest ...args: Parameters<F>

        Returns ReturnType<F>[]

      • Parameters

        • collection: any
        • Optional path: any
        • Rest ...args: any[]

        Returns any

  • isArguments: (value: any) => boolean
      • (value: any): boolean
      • Checks if value is likely an arguments object.

        since

        5.5.0

        category

        Lang

        example
        isArguments(function() { return arguments }())
        // => true

        isArguments([1, 2, 3])
        // => false

        Parameters

        • value: any

          The value to check.

        Returns boolean

        Returns true if value is an arguments object, else false.

  • isArray: (value: any) => value is any[]
      • (value: any): value is any[]
      • Checks if value is classified as an Array object.

        since

        5.5.0

        category

        Lang

        example
        isArray([1, 2, 3]);
        // => true

        isArray(document.body.children);
        // => false

        isArray('abc');
        // => false

        isArray(noop);
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is any[]

        Returns true if value is an array, else false.

  • isArrayLike: (value: any) => boolean
      • (value: any): boolean
      • Checks if value is array-like. A value is considered array-like if it's not a function and has a value.length that's an integer greater than or equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

        since

        5.3.0

        category

        Lang

        example
        isArrayLike([1, 2, 3])
        // => true

        isArrayLike(document.body.children)
        // => true

        isArrayLike('abc')
        // => true

        isArrayLike(Function)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns boolean

        Returns true if value is array-like, else false.

  • isCircular: (obj: any) => boolean
      • (obj: any): boolean
      • given an object, check wether the object has circular reference or not

        since

        5.18.0

        category

        Object

        Parameters

        • obj: any

        Returns boolean

        truth if the given object has circular reference

  • isDate: (value: any) => value is Date
      • (value: any): value is Date
      • Checks if value is classified as a Date object.

        since

        5.5.0

        category

        Lang

        example
        isDate(new Date)
        // => true

        isDate('Mon April 23 2012')
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is Date

        Returns true if value is a date object, else false.

  • isEmpty: (value?: any) => boolean
      • (value?: any): boolean
      • Checks if value is an empty object, collection, map, or set.

        Objects are considered empty if they have no own enumerable string keyed properties.

        Array-like values such as arguments objects, arrays, buffers, strings, or jQuery-like collections are considered empty if they have a length of 0. Similarly, maps and sets are considered empty if they have a size of 0.

        heavy operation

        since

        5.5.0

        category

        Lang

        example
        isEmpty(null)
        // => true

        isEmpty(true)
        // => true

        isEmpty(1)
        // => true

        isEmpty([1, 2, 3])
        // => false

        isEmpty('abc')
        // => false

        isEmpty({ 'a': 1 })
        // => false

        Parameters

        • Optional value: any

          The value to check.

        Returns boolean

        Returns true if value is empty, else false.

  • isEqual: (value: any, other: any) => boolean
      • (value: any, other: any): boolean
      • Performs a deep comparison between two values to determine if they are equivalent.

        Note: This method supports comparing arrays, array buffers, booleans, date objects, error objects, maps, numbers, Object objects, regexes, sets, strings, symbols, and typed arrays. Object objects are compared by their own, not inherited, enumerable properties. Functions and DOM nodes are compared by strict equality, i.e. ===.

        since

        5.3.0

        category

        Lang

        example
        var object = { 'a': 1 };
        var other = { 'a': 1 };

        _.isEqual(object, other);
        // => true

        object === other;
        // => false

        Parameters

        • value: any

          The value to compare.

        • other: any

          The other value to compare.

        Returns boolean

        Returns true if the values are equivalent, else false.

  • isEqualWith: <V1, V2>(value: V1, other: V2, customizer?: (v1?: V1, v2?: V2) => boolean) => boolean
      • <V1, V2>(value: V1, other: V2, customizer?: (v1?: V1, v2?: V2) => boolean): boolean
      • This method is like isEqual except that it accepts customizer which is invoked to compare values. If customizer returns undefined, comparisons are handled by the method instead. The customizer is invoked with up to six arguments: (objValue, othValue [, index|key, object, other, stack]).

        since

        5.10.1

        category

        Lang

        example
        function isGreeting(value) {
        return /^h(?:i|ello)$/.test(value)
        }

        function customizer(objValue, othValue) {
        if (isGreeting(objValue) && isGreeting(othValue)) {
        return true
        }
        }

        const array = ['hello', 'goodbye']
        const other = ['hi', 'goodbye']

        isEqualWith(array, other, customizer)
        // => true

        Type parameters

        • V1

        • V2

        Parameters

        • value: V1

          The value to compare.

        • other: V2

          The other value to compare.

        • Optional customizer: (v1?: V1, v2?: V2) => boolean

          The function to customize comparisons.

            • (v1?: V1, v2?: V2): boolean
            • Parameters

              • Optional v1: V1
              • Optional v2: V2

              Returns boolean

        Returns boolean

        Returns true if the values are equivalent, else false.

  • isError: (value: any) => value is Error
      • (value: any): value is Error
      • Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError object.

        since

        5.6.0

        category

        Lang

        example
        isError(new Error)
        // => true

        isError(Error)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is Error

        Returns true if value is an error object, else false.

  • isFunction: (value: any) => value is Function
      • (value: any): value is Function
      • Checks if value is classified as a Function object.

        since

        5.5.0

        category

        Lang

        example
        isFunction(class Any{})
        // => true

        isFunction(() => {})
        // => true

        isFunction(async () => {})
        // => true

        isFunction(function * Any() {})
        // => true

        isFunction(Math.round)
        // => true

        isFunction(/abc/)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is Function

        Returns true if value is a function, else false.

  • isInstance: <T>(inst: any, aClass: Class<T>) => inst is T
      • <T>(inst: any, aClass: Class<T>): inst is T
      • is instance of a class

        since

        5.16.0

        category

        Lang

        Type parameters

        • T

        Parameters

        • inst: any
        • aClass: Class<T>

        Returns inst is T

  • isMap: (value: any) => value is Map<any, any>
      • (value: any): value is Map<any, any>
      • Checks if value is classified as a Map object.

        since

        5.5.0

        category

        Lang

        example
        isMap(new Map)
        // => true

        isMap(new WeakMap)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is Map<any, any>

        Returns true if value is a map, else false.

  • isNull: (value: any) => value is null
      • (value: any): value is null
      • Checks if value is null.

        since

        5.6.0

        category

        Lang

        example
        isNull(null)
        // => true

        isNull(void 0)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is null

        Returns true if value is null, else false.

  • isNumber: (value: any) => value is number
      • (value: any): value is number
      • Checks if value is classified as a Number primitive or object.

        Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the Number.isFinite method.

        since

        5.6.0

        category

        Lang

        see

        [[isInteger]], [[toInteger]], [[[[toNumber]]]]

        example
        isNumber(3)
        // => true

        isNumber(Number.MIN_VALUE)
        // => true

        isNumber(Infinity)
        // => true

        isNumber('3')
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is number

        Returns true if value is a number, else false.

  • isObject: (value: any) => boolean
      • (value: any): boolean
      • Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))

        since

        5.6.0

        category

        Lang

        example
        isObject({})
        // => true

        isObject([1, 2, 3])
        // => true

        isObject(Function)
        // => true

        isObject(null)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns boolean

        Returns true if value is an object, else false.

  • isString: (value: any) => value is string
      • (value: any): value is string
      • Checks if value is classified as a String primitive or object.

        since

        0.1.0

        category

        Lang

        example
        isString('abc')
        // => true

        isString(1)
        // => false

        Parameters

        • value: any

          The value to check.

        Returns value is string

        Returns true if value is a string, else false.

  • isSubClass: (subClass: Class<any>, parentClass: Class<any>) => boolean
      • (subClass: Class<any>, parentClass: Class<any>): boolean
      • check a class is the sub-class of one class

        since

        5.15.0

        category

        Function

        Parameters

        Returns boolean

  • join: (array: any[], separator?: string) => string
      • (array: any[], separator?: string): string
      • Converts all elements in array into a string separated by separator.

        since

        5.0.0

        category

        Array

        example
        join(['a', 'b', 'c'], '~');
        // => 'a~b~c'

        Parameters

        • array: any[]

          The array to convert.

        • separator: string = ','

          The element separator.

        Returns string

        Returns the joined string.

  • keys: (object: any) => string[]
      • (object: any): string[]
      • Creates an array of the own enumerable property names of object.

        Note: Non-object values are coerced to objects. See the ES spec for more details.

        since

        5.5.0

        category

        Object

        see

        [[values]], [[valuesIn]]

        example
        function Foo() {
        this.a = 1
        this.b = 2
        }

        Foo.prototype.c = 3

        keys(new Foo)
        // => ['a', 'b'] (iteration order is not guaranteed)

        keys('hi')
        // => ['0', '1']

        Parameters

        • object: any

          The object to query.

        Returns string[]

        Returns the array of property names.

  • last: <T>(array: ArrayLike<T>) => T
      • <T>(array: ArrayLike<T>): T
      • Gets the last element of array.

        since

        5.6.0

        category

        Array

        example
        last([1, 2, 3])
        // => 3

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to query.

        Returns T

        Returns the last element of array.

  • lastIndexOf: <T>(array: ArrayLike<T>, value: T, fromIndex: number) => number
      • <T>(array: ArrayLike<T>, value: T, fromIndex: number): number
      • This method is like indexOf except that it iterates over elements of array from right to left.

        since

        5.6.0

        category

        Array

        example
        lastIndexOf([1, 2, 1, 2], 2)
        // => 3

        // Search from the `fromIndex`.
        lastIndexOf([1, 2, 1, 2], 2, 2)
        // => 1

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to inspect.

        • value: T

          The value to search for.

        • fromIndex: number

          The index to search from.

        Returns number

        Returns the index of the matched value, else -1.

  • logic: { allTrue: (...expressions: (boolean | BoolFunction)[]) => boolean; anyTrue: (...expressions: (boolean | BoolFunction)[]) => boolean; asyncAllTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean>; asyncAnyTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean> }
    • allTrue: (...expressions: (boolean | BoolFunction)[]) => boolean
        • (...expressions: (boolean | BoolFunction)[]): boolean
        • (sync) allTrue

          since

          5.15.0

          Parameters

          • Rest ...expressions: (boolean | BoolFunction)[]

          Returns boolean

          all expressions return true

    • anyTrue: (...expressions: (boolean | BoolFunction)[]) => boolean
        • (...expressions: (boolean | BoolFunction)[]): boolean
        • (sync) anyTrue

          since

          5.15.0

          Parameters

          • Rest ...expressions: (boolean | BoolFunction)[]

          Returns boolean

    • asyncAllTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean>
        • (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]): Promise<boolean>
        • (async) allTrue

          since

          5.15.0

          Parameters

          • Rest ...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]

          Returns Promise<boolean>

          all expressions return true

    • asyncAnyTrue: (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]) => Promise<boolean>
        • (...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]): Promise<boolean>
        • (async) anyTrue

          since

          5.15.0

          Parameters

          • Rest ...expressions: (boolean | BoolFunction | AsyncBoolFunction)[]

          Returns Promise<boolean>

  • lowerCase: (str: string) => string
      • (str: string): string
      • Converts string, as space separated words, to lower case.

        since

        5.6.0

        category

        String

        see

        camelCase, kebabCase, snakeCase, startCase, upperCase, upperFirst

        example
        lowerCase('--Foo-Bar--')
        // => 'foo bar'

        lowerCase('fooBar')
        // => 'foo bar'

        lowerCase('__FOO_BAR__')
        // => 'foo bar'

        Parameters

        • str: string

          The string to convert.

        Returns string

        Returns the lower cased string.

  • lt: <T>(value: T, other: T) => boolean
      • <T>(value: T, other: T): boolean
      • Checks if value is less than other.

        since

        5.6.0

        category

        Lang

        see

        gt, gte, lte

        example
        lt(1, 3)
        // => true

        lt(3, 3)
        // => false

        lt(3, 1)
        // => false

        Type parameters

        • T

        Parameters

        • value: T

          The value to compare.

        • other: T

          The other value to compare.

        Returns boolean

        Returns true if value is less than other, else false.

  • map: { <T>(collection: T): Tuple<T>; <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, R>): R[]; <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, R>): R[]; (collection: any, iteratee?: any): [] }
      • <T>(collection: T): Tuple<T>
      • <T, R>(collection: ArrayLike<T>, iteratee?: ArrayIteratee<T, R>): R[]
      • <T, R>(collection: Record<string, T>, iteratee?: RecordIteratee<T, R>): R[]
      • (collection: any, iteratee?: any): []
      • Creates an array of values by running each element in collection thru iteratee. The iteratee is invoked with three arguments: (value, index|key, collection).

        Many lodash methods are guarded to work as iteratee for methods like every, filter, map, mapValues, reject, and some.

        The guarded methods are: ary, chunk, curry, curryRight, drop, dropRight, every, fill, invert, parseInt, random, range, rangeRight, repeat, sampleSize, slice, some, sortBy, split, take, takeRight, template, trim, trimEnd, trimStart, and words

        since

        5.0.0

        category

        Collection

        example
        function square(n) {
        return n * n;
        }

        map([4, 8], square);
        // => [16, 64]

        map({ 'a': 4, 'b': 8 }, square);
        // => [16, 64] (iteration order is not guaranteed)

        var users = [
        { 'user': 'barney' },
        { 'user': 'fred' }
        ];

        map(users, 'user');
        // => ['barney', 'fred']

        Type parameters

        • T: any[] | []

        Parameters

        • collection: T

        Returns Tuple<T>

      • Type parameters

        • T

        • R = any

        Parameters

        • collection: ArrayLike<T>
        • Optional iteratee: ArrayIteratee<T, R>

        Returns R[]

      • Type parameters

        • T

        • R = any

        Parameters

        • collection: Record<string, T>
        • Optional iteratee: RecordIteratee<T, R>

        Returns R[]

      • Parameters

        • collection: any
        • Optional iteratee: any

        Returns []

  • mapKeys: { <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject; <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject }
      • <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject
      • <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject
      • The opposite of mapValue this method creates an object with the same values as object and keys generated by running each own enumerable string keyed property of object thru iteratee. The iteratee is invoked with three arguments: (value, key, object).

        since

        5.11.0

        category

        Object

        see

        [[mapValue]]

        example
        mapKey({ 'a': 1, 'b': 2 }, function(value, key) {
        return key + value
        })
        // => { 'a1': 1, 'b2': 2 }

        Type parameters

        • T

        Parameters

        • object: PlainObject<T>

          The object to iterate over.

        • iteratee: KeyIteratee

          The function invoked per iteration.

        Returns PlainObject

        Returns the new mapped object.

      • Type parameters

        • T

        Parameters

        • object: PlainObject<T>
        • iteratee: CollectionIteratee<T, any>

        Returns PlainObject

  • mapValues: { <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject; <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject }
      • <T>(object: PlainObject<T>, iteratee: KeyIteratee): PlainObject
      • <T>(object: PlainObject<T>, iteratee: CollectionIteratee<T, any>): PlainObject
      • Creates an object with the same keys as object and values generated by running each own enumerable string keyed property of object thru iteratee. The iteratee is invoked with three arguments: (value, key, object).

        since

        5.11.0

        category

        Object

        see

        mapKeys

        example
        const users = {
        'fred': { 'user': 'fred', 'age': 40 },
        'pebbles': { 'user': 'pebbles', 'age': 1 }
        }

        mapValue(users, ({ age }) => age)
        // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)

        Type parameters

        • T

        Parameters

        • object: PlainObject<T>

          The object to iterate over.

        • iteratee: KeyIteratee

          The function invoked per iteration.

        Returns PlainObject

        Returns the new mapped object.

      • Type parameters

        • T

        Parameters

        • object: PlainObject<T>
        • iteratee: CollectionIteratee<T, any>

        Returns PlainObject

  • matchesProperty: (path: ArrayPath, srcValue: any) => (object: any) => boolean
      • (path: ArrayPath, srcValue: any): (object: any) => boolean
      • Creates a function that performs a partial deep comparison between the value at path of a given object to srcValue, returning true if the object value is equivalent, else false.

        Note: Partial comparisons will match empty array and empty object srcValue values against any array or object value, respectively. See isEqual for a list of supported value comparisons.

        since

        5.11.0

        category

        Util

        example
        const objects = [
        { 'a': 1, 'b': 2, 'c': 3 },
        { 'a': 4, 'b': 5, 'c': 6 }
        ]

        find(objects, matchesProperty('a', 4))
        // => { 'a': 4, 'b': 5, 'c': 6 }

        Parameters

        • path: ArrayPath

          The path of the property to get.

        • srcValue: any

          The value to match.

        Returns (object: any) => boolean

        Returns the new spec function.

          • (object: any): boolean
          • Creates a function that performs a partial deep comparison between the value at path of a given object to srcValue, returning true if the object value is equivalent, else false.

            Note: Partial comparisons will match empty array and empty object srcValue values against any array or object value, respectively. See isEqual for a list of supported value comparisons.

            Parameters

            • object: any

            Returns boolean

            Returns the new spec function.

  • max: <T>(array: ArrayLike<T>) => T
      • <T>(array: ArrayLike<T>): T
      • Computes the maximum value of array. If array is empty or falsey, undefined is returned.

        since

        5.6.0

        category

        Math

        example
        _.max([4, 2, 8, 6]);
        // => 8

        _.max([]);
        // => undefined

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to iterate over.

        Returns T

        Returns the maximum value.

  • maxBy: { <T>(array: ArrayLike<T>, iteratee?: any): T; (array: any, iteratee?: any): any }
      • <T>(array: ArrayLike<T>, iteratee?: any): T
      • (array: any, iteratee?: any): any
      • This method is like max except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked. The iteratee is invoked with one argument: (value).

        since

        5.8.0

        category

        Math

        example
        const objects = [{ 'n': 1 }, { 'n': 2 }]

        maxBy(objects, ({ n }) => n)
        // => { 'n': 2 }

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to iterate over.

        • Optional iteratee: any

          The iteratee invoked per element.

        Returns T

        Returns the maximum value.

      • Parameters

        • array: any
        • Optional iteratee: any

        Returns any

  • mean: (array: number[]) => number
      • (array: number[]): number
      • Computes the mean of the values in array.

        since

        5.11.0

        category

        Math

        example
        mean([4, 2, 8, 6])
        // => 5

        Parameters

        • array: number[]

          The array to iterate over.

        Returns number

        Returns the mean.

  • meanBy: <T>(array: T[], iteratee: ArrayIteratee<T, number>) => number
      • <T>(array: T[], iteratee: ArrayIteratee<T, number>): number
      • This method is like mean except that it accepts iteratee which is invoked for each element in array to generate the value to be averaged. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Math

        example

        const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]

        meanBy(objects, ({ n }) => n) // => 5

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The array to iterate over.

        • iteratee: ArrayIteratee<T, number>

          The iteratee invoked per element.

        Returns number

        Returns the mean.

  • memoize: typeof memoize
  • merge: { <A, B, C, D>(target: A, s1: B, s2: C, s3: D): A & B & C & D; <A, B, C>(target: A, s1: B, s2: C): A & B & C; <A, B>(target: A, s1: B): A & B }
      • <A, B, C, D>(target: A, s1: B, s2: C, s3: D): A & B & C & D
      • <A, B, C>(target: A, s1: B, s2: C): A & B & C
      • <A, B>(target: A, s1: B): A & B
      • This method is like assign except that it recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. Source properties that resolve to undefined are skipped if a destination value exists. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

        Note: This method mutates object.

        since

        5.0.0

        category

        Object

        example
        const object = {
        'a': [{ 'b': 2 }, { 'd': 4 }]
        }

        const other = {
        'a': [{ 'c': 3 }, { 'e': 5 }]
        }

        merge(object, other)
        // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }

        Type parameters

        • A

        • B

        • C

        • D

        Parameters

        • target: A
        • s1: B
        • s2: C
        • s3: D

        Returns A & B & C & D

        Returns object.

      • Type parameters

        • A

        • B

        • C

        Parameters

        • target: A
        • s1: B
        • s2: C

        Returns A & B & C

      • Type parameters

        • A

        • B

        Parameters

        • target: A
        • s1: B

        Returns A & B

  • mergeWith: (object: any, ...sourcesOrCustomizer: any[]) => any
      • (object: any, ...sourcesOrCustomizer: any[]): any
      • This method is like merge except that it accepts customizer which is invoked to produce the merged values of the destination and source properties. If customizer returns undefined, merging is handled by the method instead. The customizer is invoked with six arguments: (objValue, srcValue, key, object, source, stack).

        Note: This method mutates object.

        since

        5.12.0

        category

        Object

        example
        function customizer(objValue, srcValue) {
        if (Array.isArray(objValue)) {
        return objValue.concat(srcValue)
        }
        }

        const object = { 'a': [1], 'b': [2] }
        const other = { 'a': [3], 'b': [4] }

        mergeWith(object, other, customizer)
        // => { 'a': [1, 3], 'b': [2, 4] }

        Parameters

        • object: any

          The destination object.

        • Rest ...sourcesOrCustomizer: any[]

          The source objects. The function to customize assigned values.

        Returns any

        Returns object.

  • method: (path: ArrayPath, ...args: any[]) => any
      • (path: ArrayPath, ...args: any[]): any
      • Creates a function that invokes the method at path of a given object. Any additional arguments are provided to the invoked method.

        since

        5.11.0

        category

        Util

        example
        const objects = [
        { 'a': { 'b': () => 2 } },
        { 'a': { 'b': () => 1 } }
        ]

        map(objects, method('a.b'))
        // => [2, 1]

        map(objects, method(['a', 'b']))
        // => [2, 1]

        Parameters

        • path: ArrayPath

          The path of the method to invoke.

        • Rest ...args: any[]

          The arguments to invoke the method with.

        Returns any

        Returns the new invoker function.

  • methodOf: (object: any, ...args: any[]) => any
      • (object: any, ...args: any[]): any
      • The opposite of method this method creates a function that invokes the method at a given path of object. Any additional arguments are provided to the invoked method.

        since

        5.12.0

        category

        Util

        example
        const array = times(3, i => () => i)
        const object = { 'a': array, 'b': array, 'c': array }

        map(['a[2]', 'c[0]'], methodOf(object))
        // => [2, 0]

        map([['a', '2'], ['c', '0']], methodOf(object))
        // => [2, 0]

        Parameters

        • object: any

          The object to query.

        • Rest ...args: any[]

          The arguments to invoke the method with.

        Returns any

        Returns the new invoker function.

  • min: { <T>(array: ArrayLike<T>): T; (array: any): any }
      • <T>(array: ArrayLike<T>): T
      • (array: any): any
      • Computes the minimum value of array. If array is empty or falsey, undefined is returned.

        since

        5.8.0

        category

        Math

        example
        min([4, 2, 8, 6]);
        // => 2

        min([]);
        // => undefined

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to iterate over.

        Returns T

        Returns the minimum value.

      • Parameters

        • array: any

        Returns any

  • minBy: <T>(array: ArrayLike<T>, iteratee?: any) => T
      • <T>(array: ArrayLike<T>, iteratee?: any): T
      • This method is like min except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked. The iteratee is invoked with one argument: (value).

        since

        5.8.0

        category

        Math

        example
        const objects = [{ 'n': 1 }, { 'n': 2 }]

        minBy(objects, ({ n }) => n)
        // => { 'n': 1 }

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to iterate over.

        • Optional iteratee: any

          The iteratee invoked per element.

        Returns T

        Returns the minimum value.

  • omit: <T>(object: T, ...paths: ArrayPath[]) => Partial<T>
      • <T>(object: T, ...paths: ArrayPath[]): Partial<T>
      • The opposite of pick;

        this method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.

        category

        Object

        since

        5.18.0

        example
        const object = { 'a': 1, 'b': '2', 'c': 3 };
        omit(object, ['a', 'c']);
        // => { 'b': '2' }

        Type parameters

        • T: unknown

        Parameters

        • object: T
        • Rest ...paths: ArrayPath[]

        Returns Partial<T>

  • over: (...iteratees: Function[]) => OverFunction
      • (...iteratees: Function[]): OverFunction
      • Creates a function that invokes iteratees with the arguments it receives and returns their results.

        since

        5.11.0

        category

        Util

        example
        const func = over([Math.max, Math.min])

        func(1, 2, 3, 4)
        // => [4, 1]

        Parameters

        • Rest ...iteratees: Function[]

          The iteratees to invoke.

        Returns OverFunction

        Returns the new function.

  • overArgs: (func: Function, transforms: Function[]) => Function
      • (func: Function, transforms: Function[]): Function
      • Creates a function that invokes func with its arguments transformed.

        since

        5.11.0

        category

        Function

        example
        function doubled(n) {
        return n * 2
        }

        function square(n) {
        return n * n
        }

        const func = overArgs((x, y) => [x, y], [square, doubled])

        func(9, 3)
        // => [81, 6]

        func(10, 5)
        // => [100, 10]

        Parameters

        • func: Function

          The function to wrap.

        • transforms: Function[]

          The argument transforms.

        Returns Function

        Returns the new function.

  • overEvery: (...iteratees: Function[]) => OverEveryFunction
      • (...iteratees: Function[]): OverEveryFunction
      • Creates a function that checks if all of the predicates return truthy when invoked with the arguments it receives.

        since

        5.11.0

        category

        Util

        example
        const func = overEvery([Boolean, isFinite])

        func('1')
        // => true

        func(null)
        // => false

        func(NaN)
        // => false

        Parameters

        • Rest ...iteratees: Function[]

        Returns OverEveryFunction

        Returns the new function.

  • overSome: (...iteratees: Function[]) => OverSomeFunction
      • (...iteratees: Function[]): OverSomeFunction
      • Creates a function that checks if any of the predicates return truthy when invoked with the arguments it receives.

        since

        5.11.0

        category

        Util

        example
        const func = overSome([Boolean, isFinite])

        func('1')
        // => true

        func(null)
        // => true

        func(NaN)
        // => false

        Parameters

        • Rest ...iteratees: Function[]

        Returns OverSomeFunction

        Returns the new function.

  • pad: (string?: string, length?: number, chars?: string) => string
      • (string?: string, length?: number, chars?: string): string
      • Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.

        since

        5.12.0

        category

        String

        example
        pad('abc', 8)
        // => ' abc '

        pad('abc', 8, '_-')
        // => '_-abc_-_'

        pad('abc', 2)
        // => 'abc'

        Parameters

        • string: string = ''

          The string to pad.

        • length: number = 0

          The padding length.

        • chars: string = ' '

          The string used as padding.

        Returns string

        Returns the padded string.

  • padEnd: (string?: string, length?: number, chars?: string) => string
      • (string?: string, length?: number, chars?: string): string
      • Pads string on the right side if it's shorter than length. Padding characters are truncated if they exceed length.

        since

        5.12.0

        category

        String

        example
        padEnd('abc', 6)
        // => 'abc '

        padEnd('abc', 6, '_-')
        // => 'abc_-_'

        padEnd('abc', 2)
        // => 'abc'

        Parameters

        • string: string = ''

          The string to pad.

        • length: number = 0

          The padding length.

        • chars: string = ' '

          The string used as padding.

        Returns string

        Returns the padded string.

  • padStart: (string?: string, length?: number, chars?: string) => string
      • (string?: string, length?: number, chars?: string): string
      • Pads string on the left side if it's shorter than length. Padding characters are truncated if they exceed length.

        since

        5.12.0

        category

        String

        example
        padStart('abc', 6)
        // => ' abc'

        padStart('abc', 6, '_-')
        // => '_-_abc'

        padStart('abc', 2)
        // => 'abc'

        Parameters

        • string: string = ''

          The string to pad.

        • length: number = 0

          The padding length.

        • chars: string = ' '

          The string used as padding.

        Returns string

        Returns the padded string.

  • partial: typeof partial
  • pick: (object: any, ...paths: Path[]) => any
      • (object: any, ...paths: Path[]): any
      • Creates an object composed of the picked object properties.

        since

        5.7.0

        category

        Object

        example
        const object = { 'a': 1, 'b': '2', 'c': 3 }

        pick(object, ['a', 'c'])
        // => { 'a': 1, 'c': 3 }

        Parameters

        • object: any

          The source object.

        • Rest ...paths: Path[]

          The property paths to pick.

        Returns any

        Returns the new object.

  • pickBy: (object: any, predicate: (value: any) => boolean) => any
      • (object: any, predicate: (value: any) => boolean): any
      • Creates an object composed of the object properties predicate returns truthy for. The predicate is invoked with two arguments: (value, key).

        since

        5.7.0

        category

        Object

        example
        const object = { 'a': 1, 'b': '2', 'c': 3 }

        pickBy(object, isNumber)
        // => { 'a': 1, 'c': 3 }

        Parameters

        • object: any

          The source object.

        • predicate: (value: any) => boolean

          The function invoked per property.

            • (value: any): boolean
            • Parameters

              • value: any

              Returns boolean

        Returns any

        Returns the new object.

  • pull: <T>(array: T[], ...values: T[]) => T[]
      • <T>(array: T[], ...values: T[]): T[]
      • Removes all given values from array using SameValueZero for equality comparisons.

        Note: Unlike without, this method mutates array. Use remove to remove elements from an array by predicate.

        since

        5.11.0

        category

        Array

        see

        pullAll, [[pullAllBy]], pullAllWith, pullAt, remove, reject

        example
        const array = ['a', 'b', 'c', 'a', 'b', 'c']

        pull(array, 'a', 'c')
        console.log(array)
        // => ['b', 'b']

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to modify.

        • Rest ...values: T[]

          The values to remove.

        Returns T[]

        Returns array.

  • pullAll: <T>(array: T[], values: T[]) => T[]
      • <T>(array: T[], values: T[]): T[]
      • This method is like pull except that it accepts an array of values to remove.

        Note: Unlike difference, this method mutates array.

        since

        5.11.0

        category

        Array

        see

        pull, [[pullAllBy]], pullAllWith, pullAt, remove, reject

        example
        const array = ['a', 'b', 'c', 'a', 'b', 'c']

        pullAll(array, ['a', 'c'])
        console.log(array)
        // => ['b', 'b']

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to modify.

        • values: T[]

          The values to remove.

        Returns T[]

        Returns array.

  • pullAllWith: <T>(array: T[], values: T[], comparator: Comparator<T>) => T[]
      • <T>(array: T[], values: T[], comparator: Comparator<T>): T[]
      • This method is like pullAll except that it accepts comparator which is invoked to compare elements of array to values. The comparator is invoked with two arguments: (arrVal, othVal).

        Note: Unlike differenceWith, this method mutates array.

        since

        5.11.0

        category

        Array

        see

        pull, pullAll, [[pullAllBy]], pullAt, remove, reject

        example
        const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]

        pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)
        console.log(array)
        // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to modify.

        • values: T[]

          The values to remove.

        • comparator: Comparator<T>

          The comparator invoked per element.

        Returns T[]

        Returns array.

  • pullAt: <T>(array: T[], ...indexes: (string | number)[]) => T[]
      • <T>(array: T[], ...indexes: (string | number)[]): T[]
      • Removes elements from array corresponding to indexes and returns an array of removed elements.

        Note: Unlike at, this method mutates array.

        since

        5.11.0

        category

        Array

        see

        pull, pullAll, [[pullAllBy]], pullAllWith, remove, reject

        example
        const array = ['a', 'b', 'c', 'd']
        const pulled = pullAt(array, [1, 3])

        console.log(array)
        // => ['a', 'c']

        console.log(pulled)
        // => ['b', 'd']

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The array to modify.

        • Rest ...indexes: (string | number)[]

          The indexes of elements to remove.

        Returns T[]

        Returns the new array of removed elements.

  • random: { (floating?: boolean): number; (upper?: string | number, floating?: boolean): number; (lower?: string | number, upper?: string | number, floating?: boolean): number }
      • (floating?: boolean): number
      • (upper?: string | number, floating?: boolean): number
      • (lower?: string | number, upper?: string | number, floating?: boolean): number
      • Produces a random number between the inclusive lower and upper bounds. If only one argument is provided a number between 0 and the given number is returned. If floating is true, or either lower or upper are floats, a floating-point number is returned instead of an integer.

        Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.

        since

        5.5.0

        category

        Number

        see

        uniqueId

        example
        random(0, 5)
        // => an integer between 0 and 5

        random(5)
        // => also an integer between 0 and 5

        random(5, true)
        // => a floating-point number between 0 and 5

        random(1.2, 5.2)
        // => a floating-point number between 1.2 and 5.2

        Parameters

        • Optional floating: boolean

          Specify returning a floating-point number.

        Returns number

        Returns the random number.

      • Parameters

        • Optional upper: string | number
        • Optional floating: boolean

        Returns number

      • Parameters

        • Optional lower: string | number
        • Optional upper: string | number
        • Optional floating: boolean

        Returns number

  • range: (start: number, end?: number, step?: number) => number[]
      • (start: number, end?: number, step?: number): number[]
      • Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. A step of -1 is used if a negative start is specified without an end or step. If end is not specified, it's set to start, and start is then set to 0.

        Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.

        since

        5.7.0

        category

        Util

        see

        [[inRange]],[[rangeRight]]

        example
        range(4)
        // => [0, 1, 2, 3]

        range(-4)
        // => [0, -1, -2, -3]

        range(1, 5)
        // => [1, 2, 3, 4]

        range(0, 20, 5)
        // => [0, 5, 10, 15]

        range(0, -4, -1)
        // => [0, -1, -2, -3]

        range(1, 4, 0)
        // => [1, 1, 1]

        range(0)
        // => []

        Parameters

        • start: number

          The start of the range.

        • Optional end: number

          The end of the range.

        • Optional step: number

          The value to increment or decrement by.

        Returns number[]

        Returns the range of numbers.

  • reduce: { <T, R>(collection?: Record<string, T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R; <T, R>(collection?: ArrayLike<T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R }
      • <T, R>(collection?: Record<string, T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R
      • <T, R>(collection?: ArrayLike<T>, iteratee?: AccCollectionIteratee<T, R>, accumulator?: R): R
      • Reduces collection to a value which is the accumulated result of running each element in collection thru iteratee, where each successive invocation is supplied the return value of the previous. If accumulator is not given, the first element of collection is used as the initial value. The iteratee is invoked with four arguments: (accumulator, value, index|key, collection).

        Many lodash methods are guarded to work as iteratees for methods like reduce, reduceRight, and transform.

        The guarded methods are: assign, defaults, defaultsDeep, includes, merge, orderBy, and sortBy

        since

        5.0.0

        category

        Collection

        see

        [[reduceRight]],[[transform]]

        example
        reduce([1, 2], (sum, n) => sum + n, 0)
        // => 3

        reduce({ 'a': 1, 'b': 2, 'c': 1 }, (result, value, key) => {
        (result[value] || (result[value] = [])).push(key)
        return result
        }, {})
        // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)

        Type parameters

        • T

        • R

        Parameters

        • Optional collection: Record<string, T>

          The collection to iterate over.

        • Optional iteratee: AccCollectionIteratee<T, R>

          The function invoked per iteration.

        • Optional accumulator: R

          The initial value.

        Returns R

        Returns the accumulated value.

      • Type parameters

        • T

        • R

        Parameters

        • Optional collection: ArrayLike<T>
        • Optional iteratee: AccCollectionIteratee<T, R>
        • Optional accumulator: R

        Returns R

  • reject: <T>(collection: Collection<T>, predicate: CollectionIteratee<T, any>) => T[]
      • <T>(collection: Collection<T>, predicate: CollectionIteratee<T, any>): T[]
      • The opposite of filter this method returns the elements of collection that predicate does not return truthy for.

        since

        5.9.0

        category

        Collection

        see

        pull, pullAll, [[pullAllBy]], pullAllWith, pullAt, remove, filter

        example
        const users = [
        { 'user': 'barney', 'active': true },
        { 'user': 'fred', 'active': false }
        ]

        reject(users, ({ active }) => active)
        // => objects for ['fred']

        Type parameters

        • T

        Parameters

        • collection: Collection<T>

          The collection to iterate over.

        • predicate: CollectionIteratee<T, any>

          The function invoked per iteration.

        Returns T[]

        Returns the new filtered array.

  • remove: <T>(array: ArrayLike<T>, predicate: CollectionIteratee<T, boolean>) => T[]
      • <T>(array: ArrayLike<T>, predicate: CollectionIteratee<T, boolean>): T[]
      • Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. The predicate is invoked with three arguments: (value, index, array).

        Note: Unlike filter, this method mutates array. Use pull to pull elements from an array by value.

        since

        5.11.0

        category

        Array

        see

        pull, pullAll, [[pullAllBy]], pullAllWith, pullAt, reject, filter

        example
        const array = [1, 2, 3, 4]
        const evens = remove(array, n => n % 2 == 0)

        console.log(array)
        // => [1, 3]

        console.log(evens)
        // => [2, 4]

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to modify.

        • predicate: CollectionIteratee<T, boolean>

          The function invoked per iteration.

        Returns T[]

        Returns the new array of removed elements.

  • repeat: (str: string, n?: number, guard?: any) => string
      • (str: string, n?: number, guard?: any): string
      • Repeats the given string n times.

        since

        5.7.0

        category

        String

        example
        repeat('*', 3)
        // => '***'

        repeat('abc', 2)
        // => 'abcabc'

        repeat('abc', 0)
        // => ''

        Parameters

        • str: string

          The string to repeat.

        • n: number = 1

          The number of times to repeat the string.

        • Optional guard: any

        Returns string

        Returns the repeated string.

  • replace: (...args: any[]) => string
      • (...args: any[]): string
      • Replaces matches for pattern in string with replacement.

        Note: This method is based on String#replace.

        since

        5.8.0

        category

        String

        see

        [[truncate]], trim

        example
        replace('Hi Fred', 'Fred', 'Barney')
        // => 'Hi Barney'

        Parameters

        • Rest ...args: any[]

        Returns string

        Returns the modified string.

  • retry: <T>(runner: T, maxRetryCount?: number, retryAfterMSecond?: number) => T
      • <T>(runner: T, maxRetryCount?: number, retryAfterMSecond?: number): T
      • make function retry-able

        e.g. if maxRetryCount is 3, it will run 3 times at most (include the first one), and return the final error.

        since

        5.14.0

        category

        Async

        Type parameters

        • T

        Parameters

        • runner: T

          async function, return promise

        • maxRetryCount: number = 3

          the maximum number of times a runner should retry, default is 3

        • retryAfterMSecond: number = 0

          (async function required, for sync function, this parameter will not be applied) the wait milliseconds before retry, default is zero

        Returns T

  • series: <T>(...asyncOperations: T) => Promise<SeriesResult<T>>
      • <T>(...asyncOperations: T): Promise<SeriesResult<T>>
      • run async operations one by one, serially

        and return the result array

        if any operation raise error, the following operations will not be executed

        since

        5.14.0

        category

        Async

        example
        const [res1, res2, res3] = await series(
        () => fetch(1),
        () => fetch(2),
        () => fetch(3)
        )

        Type parameters

        Parameters

        • Rest ...asyncOperations: T

          async operations

        Returns Promise<SeriesResult<T>>

  • set: { (object: any, path: string[], value: any): any; (object: any, path: string, value: any): any }
      • (object: any, path: string[], value: any): any
      • (object: any, path: string, value: any): any
      • Sets the value at path of object. If a portion of path doesn't exist, it's created. Arrays are created for missing index properties while objects are created for all other missing properties. Use setWith to customize path creation.

        Note: This method mutates object.

        since

        5.3.0

        category

        Object

        see

        has,[[hasIn]],get,unset

        example
        const object = { 'a': [{ 'b': { 'c': 3 } }] }

        set(object, 'a[0].b.c', 4)
        console.log(object.a[0].b.c)
        // => 4

        set(object, ['x', '0', 'y', 'z'], 5)
        console.log(object.x[0].y.z)
        // => 5

        Parameters

        • object: any

          The object to modify.

        • path: string[]

          The path of the property to set.

        • value: any

          The value to set.

        Returns any

        Returns object.

      • Parameters

        • object: any
        • path: string
        • value: any

        Returns any

  • size: { (collection: string): number; (collection: ArrayLike<any>): number; (collection: Record<string, any>): number; (collection: any): number }
      • (collection: string): number
      • (collection: ArrayLike<any>): number
      • (collection: Record<string, any>): number
      • (collection: any): number
      • Gets the size of collection by returning its length for array-like values or the number of own enumerable string keyed properties for objects.

        since

        5.7.0

        category

        Collection

        example
        size([1, 2, 3])
        // => 3

        size({ 'a': 1, 'b': 2 })
        // => 2

        size('pebbles')
        // => 7

        Parameters

        • collection: string

          The collection to inspect.

        Returns number

        Returns the collection size.

      • Parameters

        • collection: ArrayLike<any>

        Returns number

      • Parameters

        • collection: Record<string, any>

        Returns number

      • Parameters

        • collection: any

        Returns number

  • sleep: (ms: number) => Promise<void>
      • (ms: number): Promise<void>
      • async sleep, release CPU and go to next action after milliseconds

        category

        Async

        example

        async function() {
        await sleep(1000)
        // after 1 seconds
        // do something other
        }

        Parameters

        • ms: number

          millisecond

        Returns Promise<void>

  • slice: <T>(array: ArrayLike<T>, start?: number, end?: number) => T[]
      • <T>(array: ArrayLike<T>, start?: number, end?: number): T[]
      • Creates a slice of array from start up to, but not including, end.

        Note: This method is used instead of Array#slice to ensure dense arrays are returned.

        since

        5.6.0

        category

        Array

        example
        var array = [1, 2, 3, 4]

        slice(array, 2)
        // => [3, 4]

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to slice.

        • Optional start: number

          The start position. A negative index will be treated as an offset from the end.

        • Optional end: number

          The end position. A negative index will be treated as an offset from the end.

        Returns T[]

        Returns the slice of array.

  • some: <T>(collection: ArrayLike<T>, predicate?: any, guard?: any) => boolean
      • <T>(collection: ArrayLike<T>, predicate?: any, guard?: any): boolean
      • Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate returns truthy. The predicate is invoked with three arguments: (value, index|key, collection).

        since

        5.2.0

        category

        Collection

        example

        some([null, 0, 'yes', false], Boolean); // => true

        var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred', 'active': false } ];

        // The matches iteratee shorthand. some(users, { 'user': 'barney', 'active': false }); // => false

        // The matchesProperty iteratee shorthand. some(users, ['active', false]); // => true

        // The property iteratee shorthand. some(users, 'active'); // => true

        Type parameters

        • T

        Parameters

        • collection: ArrayLike<T>

          The collection to iterate over.

        • Optional predicate: any

          The function invoked per iteration.

        • Optional guard: any

          Enables use as an iteratee for methods like map.

        Returns boolean

        Returns true if any element passes the predicate check, else false.

  • someValues: <T>(object: Record<string, T>, predicate: RecordIteratee<T, boolean>) => boolean
      • <T>(object: Record<string, T>, predicate: RecordIteratee<T, boolean>): boolean
      • Checks if predicate returns truthy for any element of object. Iteration is stopped once predicate returns truthy. The predicate is invoked with three arguments: (value, key, object).

        since

        5.11.0

        category

        Object

        example
        someValues({ 'a': 0, 'b': 'yes', 'c': false }, Boolean)
        // => true

        Type parameters

        • T = any

        Parameters

        • object: Record<string, T>

          The object to iterate over.

        • predicate: RecordIteratee<T, boolean>

          The function invoked per iteration.

        Returns boolean

        Returns true if any element passes the predicate check, else false.

  • sortedIndex: <T>(array: T[], value: T) => number
      • <T>(array: T[], value: T): number
      • Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order.

        since

        5.11.0

        category

        Array

        example
        sortedIndex([30, 50], 40)
        // => 1

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The sorted array to inspect.

        • value: T

          The value to evaluate.

        Returns number

        Returns the index at which value should be inserted into array.

  • sortedIndexBy: <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>) => number
      • <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>): number
      • This method is like sortedIndex except that it accepts iteratee which is invoked for value and each element of array to compute their sort ranking. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Array

        example
        const objects = [{ 'n': 4 }, { 'n': 5 }]

        sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)
        // => 0

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The sorted array to inspect.

        • value: T

          The value to evaluate.

        • iteratee: ArrayIteratee<T, number>

          The iteratee invoked per element.

        Returns number

        Returns the index at which value should be inserted into array.

  • sortedIndexOf: <T>(array: T[], value: T) => number
      • <T>(array: T[], value: T): number
      • This method is like indexOf except that it performs a binary search on a sorted array.

        since

        5.11.0

        category

        Array

        example
        sortedIndexOf([4, 5, 5, 5, 6], 5)
        // => 1

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to inspect.

        • value: T

          The value to search for.

        Returns number

        Returns the index of the matched value, else -1.

  • sortedLastIndex: <T>(array: T[], value: T) => number
      • <T>(array: T[], value: T): number
      • This method is like sortedIndex except that it returns the highest index at which value should be inserted into array in order to maintain its sort order.

        since

        5.11.0

        category

        Array

        example
        sortedLastIndex([4, 5, 5, 5, 6], 5)
        // => 4

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The sorted array to inspect.

        • value: T

          The value to evaluate.

        Returns number

        Returns the index at which value should be inserted into array.

  • sortedLastIndexBy: <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>) => number
      • <T>(array: T[], value: T, iteratee: ArrayIteratee<T, number>): number
      • This method is like sortedLastIndex except that it accepts iteratee which is invoked for value and each element of array to compute their sort ranking. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Array

        example
        const objects = [{ 'n': 4 }, { 'n': 5 }]

        sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n)
        // => 1

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The sorted array to inspect.

        • value: T

          The value to evaluate.

        • iteratee: ArrayIteratee<T, number>

          The iteratee invoked per element.

        Returns number

        Returns the index at which value should be inserted into array.

  • sortedLastIndexOf: <T>(array: T[], value: T) => number
      • <T>(array: T[], value: T): number
      • This method is like lastIndexOf except that it performs a binary search on a sorted array.

        since

        5.11.0

        category

        Array

        example
        sortedLastIndexOf([4, 5, 5, 5, 6], 5)
        // => 3

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to inspect.

        • value: T

          The value to search for.

        Returns number

        Returns the index of the matched value, else -1.

  • sortedUniq: <T>(array: T[]) => T[]
      • <T>(array: T[]): T[]
      • This method is like uniq except that it only works for sorted arrays. If the input array is known to be sorted sortedUniq is faster than uniq.

        since

        5.12.0

        category

        Array

        example
        sortedUniq([1, 1, 2])
        // => [1, 2]

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to inspect.

        Returns T[]

        Returns the new duplicate free array.

  • sortedUniqBy: <T>(array: T[], iteratee: ArrayIteratee<T, any>) => T[]
      • <T>(array: T[], iteratee: ArrayIteratee<T, any>): T[]
      • This method is like uniqBy except that it's designed and optimized for sorted arrays.

        since

        5.12.0

        category

        Array

        example
        sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor)
        // => [1.1, 2.3]

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The array to inspect.

        • iteratee: ArrayIteratee<T, any>

          The iteratee invoked per element.

        Returns T[]

        Returns the new duplicate free array.

  • split: (str?: string, separator?: string | RegExp, limit?: number) => string[]
      • (str?: string, separator?: string | RegExp, limit?: number): string[]
      • Splits string by separator.

        Note: This method is based on String#split.

        since

        5.0.0

        category

        String

        example
        split('a-b-c', '-', 2)
        // => ['a', 'b']

        Parameters

        • Optional str: string

          The string to split.

        • Optional separator: string | RegExp

          The separator pattern to split by.

        • Optional limit: number

          The length to truncate results to.

        Returns string[]

        Returns the string segments.

  • sum: (array: ArrayLike<number>) => number
      • (array: ArrayLike<number>): number
      • Computes the sum of the values in array.

        since

        5.6.0

        category

        Math

        example
        sum([4, 2, 8, 6])
        // => 20

        Parameters

        • array: ArrayLike<number>

          The array to iterate over.

        Returns number

        Returns the sum.

  • sumBy: (array: any, iteratee: any) => number
      • (array: any, iteratee: any): number
      • This method is like sum except that it accepts iteratee which is invoked for each element in array to generate the value to be summed. The iteratee is invoked with one argument: (value).

        since

        5.6.0

        category

        Math

        example
        const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]

        sumBy(objects, ({ n }) => n)
        // => 20

        Parameters

        • array: any

          The array to iterate over.

        • iteratee: any

          The iteratee invoked per element.

        Returns number

        Returns the sum.

  • take: <T>(array: ArrayLike<T>, n?: number, guard?: any) => T[]
      • <T>(array: ArrayLike<T>, n?: number, guard?: any): T[]
      • Creates a slice of array with n elements taken from the beginning.

        since

        5.6.0

        category

        Array

        example
        take([1, 2, 3])
        // => [1]

        take([1, 2, 3], 2)
        // => [1, 2]

        take([1, 2, 3], 5)
        // => [1, 2, 3]

        take([1, 2, 3], 0)
        // => []

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to query.

        • Optional n: number

          The number of elements to take.

        • Optional guard: any

        Returns T[]

        Returns the slice of array.

  • takeRight: <T>(array: ArrayLike<T>, n?: number) => T[]
      • <T>(array: ArrayLike<T>, n?: number): T[]
      • Creates a slice of array with n elements taken from the end.

        since

        5.6.0

        category

        Array

        example
        takeRight([1, 2, 3])
        // => [3]

        takeRight([1, 2, 3], 2)
        // => [2, 3]

        takeRight([1, 2, 3], 5)
        // => [1, 2, 3]

        takeRight([1, 2, 3], 0)
        // => []

        Type parameters

        • T

        Parameters

        • array: ArrayLike<T>

          The array to query.

        • Optional n: number

          The number of elements to take.

        Returns T[]

        Returns the slice of array.

  • throttle: (func: (...args: any[]) => any, wait?: number, options?: { leading: boolean; trailing: boolean }) => DebouncedFunction<(...args: any[]) => any>
      • (func: (...args: any[]) => any, wait?: number, options?: { leading: boolean; trailing: boolean }): DebouncedFunction<(...args: any[]) => any>
      • Creates a throttled function that only invokes func at most once per every wait milliseconds (or once per browser frame). The throttled function comes with a cancel method to cancel delayed func invocations and a flush method to immediately invoke them. Provide options to indicate whether func should be invoked on the leading and/or trailing edge of the wait timeout. The func is invoked with the last arguments provided to the throttled function. Subsequent calls to the throttled function return the result of the last func invocation.

        Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the throttled function is invoked more than once during the wait timeout.

        If wait is 0 and leading is false, func invocation is deferred until the next tick, similar to setTimeout with a timeout of 0.

        If wait is omitted in an environment with requestAnimationFrame, func invocation will be deferred until the next frame is drawn (typically about 16ms).

        See David Corbacho's article for details over the differences between throttle and debounce.

        since

        5.11.0

        category

        Function

        example
        // Avoid excessively updating the position while scrolling.
        jQuery(window).on('scroll', throttle(updatePosition, 100))

        // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
        const throttled = throttle(renewToken, 300000, { 'trailing': false })
        jQuery(element).on('click', throttled)

        // Cancel the trailing throttled invocation.
        jQuery(window).on('popstate', throttled.cancel)

        Parameters

        • func: (...args: any[]) => any

          The function to throttle.

            • (...args: any[]): any
            • Parameters

              • Rest ...args: any[]

              Returns any

        • wait: number = 0

          The number of milliseconds to delay; if omitted, requestAnimationFrame is used (if available).

        • options: { leading: boolean; trailing: boolean } = ...

          The options object.

          • leading: boolean
          • trailing: boolean

        Returns DebouncedFunction<(...args: any[]) => any>

  • timeIt: { (fn: AsyncFunction<[], void>): Promise<number>; (fn: GeneralFunction<[], void>): number }
      • time the executing time for sync/async function

        category

        Functional

        since

        5.19.0

        example
        const consumedMSeconds = await timeIt(async () => {
        // some async operations
        })

        Parameters

        Returns Promise<number>

        the consumed milliseconds of the function execution

      • Parameters

        Returns number

  • times: <T>(n: number, iteratee?: T) => ReturnType<T>
      • <T>(n: number, iteratee?: T): ReturnType<T>
      • Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with one argument: (index).

        since

        5.0.0

        category

        Util

        example
        times(3, String)
        // => ['0', '1', '2']

        times(4, () => 0)
        // => [0, 0, 0, 0]

        Type parameters

        • T: (...args: any[]) => any

        Parameters

        • n: number

          The number of times to invoke iteratee.

        • Optional iteratee: T

          The function invoked per iteration.

        Returns ReturnType<T>

        Returns the array of results.

  • toArray: (value: any) => any
      • (value: any): any
      • Converts value to an array.

        since

        5.6.0

        category

        Lang

        example
        toArray({ 'a': 1, 'b': 2 })
        // => [1, 2]

        toArray('abc')
        // => ['a', 'b', 'c']

        toArray(1)
        // => []

        toArray(null)
        // => []

        Parameters

        • value: any

          The value to convert.

        Returns any

        Returns the converted array.

  • toLower: (value: string) => string
      • (value: string): string
      • toLower case

        since

        5.19.0

        category

        String

        Parameters

        • value: string

          The string to convert.

        Returns string

        Returns the lower cased string.

  • toNumber: (value: any) => number
      • (value: any): number
      • Converts value to a number.

        since

        5.0.0

        category

        Lang

        see

        [[isInteger]],[[toInteger]],isNumber

        example
        toNumber(3.2)
        // => 3.2

        toNumber(Number.MIN_VALUE)
        // => 5e-324

        toNumber(Infinity)
        // => Infinity

        toNumber('3.2')
        // => 3.2

        Parameters

        • value: any

          The value to process.

        Returns number

        Returns the number.

  • toUpper: (value: string) => string
      • (value: string): string
      • Converts string, as a whole, to upper case just like String#toUpperCase.

        since

        5.12.0

        category

        String

        example
        _.toUpper('--foo-bar--');
        // => '--FOO-BAR--'

        _.toUpper('fooBar');
        // => 'FOOBAR'

        _.toUpper('__foo_bar__');
        // => '__FOO_BAR__'

        Parameters

        • value: string

          The string to convert.

        Returns string

        Returns the upper cased string.

  • trim: (str: string, chars: string, guard?: any) => string
      • (str: string, chars: string, guard?: any): string
      • Removes leading and trailing whitespace or specified characters from string.

        since

        5.6.0

        category

        String

        see

        trimEnd,trimStart

        example
        trim('  abc  ')
        // => 'abc'

        trim('-_-abc-_-', '_-')
        // => 'abc'

        Parameters

        • str: string

          The string to trim.

        • chars: string

          The characters to trim.

        • Optional guard: any

        Returns string

        Returns the trimmed string.

  • trimEnd: (str: string, chars: string, guard?: any) => string
      • (str: string, chars: string, guard?: any): string
      • Removes trailing whitespace or specified characters from string.

        since

        5.6.0

        category

        String

        see

        trim,trimStart

        example
        trimEnd('  abc  ')
        // => ' abc'

        trimEnd('-_-abc-_-', '_-')
        // => '-_-abc'

        Parameters

        • str: string

          The string to trim.

        • chars: string

          The characters to trim.

        • Optional guard: any

        Returns string

        Returns the trimmed string.

  • trimPrefix: (str: string, prefix: string) => string
      • (str: string, prefix: string): string
      • remove prefix from string

        since

        5.5.0

        category

        String

        see

        trimSuffix

        trimPrefix("123456", "123")
        // => '456'

        Parameters

        • str: string

          to be processed string

        • prefix: string

          prefix string

        Returns string

  • trimStart: (str: string, chars: string, guard?: any) => string
      • (str: string, chars: string, guard?: any): string
      • Removes leading whitespace or specified characters from string.

        since

        5.6.0

        category

        String

        see

        trim,trimEnd

        example
        trimStart('  abc  ')
        // => 'abc '

        trimStart('-_-abc-_-', '_-')
        // => 'abc-_-'

        Parameters

        • str: string

          The string to trim.

        • chars: string

          The characters to trim.

        • Optional guard: any

        Returns string

        Returns the trimmed string.

  • trimSuffix: (str: string, suffix: string) => string
      • (str: string, suffix: string): string
      • remove suffix from string

        since

        5.5.0

        category

        String

        see

        trimPrefix

        trimSuffix("123456789", "789")
        // => '123456'

        Parameters

        • str: string

          to be processed string

        • suffix: string

          string

        Returns string

  • unWrap: (inner: string, wrapper: string) => string
      • (inner: string, wrapper: string): string
      • unWrap a string

        since

        5.14.0

        Parameters

        • inner: string
        • wrapper: string

          the wrapped str will be added to inner

          unWrap("'value'", "'") => "value"
          unWrap("value", "'") => "value"

        Returns string

  • unionBy: <T>(...arrays: any[]) => T[]
      • <T>(...arrays: any[]): T[]
      • This method is like union except that it accepts iteratee which is invoked for each element of each arrays to generate the criterion by which uniqueness is computed. Result values are chosen from the first array in which the value occurs. The iteratee is invoked with one argument: (value).

        since

        5.11.0

        category

        Array

        see

        [[difference]], [[union]], [[unionWith]], [[without]], [[xor]], [[xorBy]]

        example
        unionBy([2.1], [1.2, 2.3], Math.floor)
        // => [2.1, 1.2]

        Type parameters

        • T

        Parameters

        • Rest ...arrays: any[]

          The arrays to inspect.

        Returns T[]

        Returns the new array of combined values.

  • uniq: { <T>(array: T[]): T[]; (array: any[]): any[] }
      • <T>(array: T[]): T[]
      • (array: any[]): any[]
      • Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.

        since

        5.7.0

        category

        Array

        see

        uniqBy, uniqWith

        example
        uniq([2, 1, 2])
        // => [2, 1]

        Type parameters

        • T

        Parameters

        • array: T[]

          The array to inspect.

        Returns T[]

        Returns the new duplicate free array.

      • Parameters

        • array: any[]

        Returns any[]

  • uniqBy: { <T>(array: T[], iteratee: KeyIteratee): T[]; <T>(array: T[], iteratee: ArrayIteratee<T, any>): T[] }
      • <T>(array: T[], iteratee: KeyIteratee): T[]
      • <T>(array: T[], iteratee: ArrayIteratee<T, any>): T[]
      • This method is like uniq except that it accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed. The order of result values is determined by the order they occur in the array. The iteratee is invoked with one argument: (value).

        since

        5.12.0

        category

        Array

        see

        uniq, uniqWith

        example
        uniqBy([2.1, 1.2, 2.3], Math.floor);
        // => [2.1, 1.2]

        // The `property` iteratee shorthand.
        uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
        // => [{ 'x': 1 }, { 'x': 2 }]

        Type parameters

        • T = any

        Parameters

        • array: T[]

          The array to inspect.

        • iteratee: KeyIteratee

          The iteratee invoked per element.

        Returns T