Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LoDashStatic

Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

Hierarchy

  • LoDashStatic

Callable

  • Creates a lodash object which wraps the given value to enable intuitive method chaining.

    In addition to Lo-Dash methods, wrappers also have the following Array methods: concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift

    Chaining is supported in custom builds as long as the value method is implicitly or explicitly included in the build.

    The chainable wrapper functions are: after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, toArray, transform, union, uniq, unset, unshift, unzip, values, where, without, wrap, and zip

    The non-chainable wrapper functions are: clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, sortedIndex, runInContext, template, unescape, uniqueId, and value

    The wrapper functions first and last return wrapped values when n is provided, otherwise they return unwrapped values.

    Explicit chaining can be enabled by using the _.chain method.

    Parameters

    • value: number

    Returns LoDashImplicitWrapper<number>

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Parameters

    • value: string

    Returns LoDashImplicitStringWrapper

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Parameters

    • value: boolean

    Returns LoDashImplicitWrapper<boolean>

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Parameters

    • value: Array<number>

    Returns LoDashImplicitNumberArrayWrapper

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Type parameters

    • T

    Parameters

    • value: Array<T>

    Returns LoDashImplicitArrayWrapper<T>

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Type parameters

    • T: __type

    Parameters

    • value: T

    Returns LoDashImplicitObjectWrapper<T>

  • Array * Chain * Collection * Date * Functions * Lang * Math * Number * Object * String * Utility *

    Parameters

    • value: any

    Returns LoDashImplicitWrapper<any>

Index

Properties

Methods

Properties

VERSION

VERSION: string

The semantic version number.

bind

Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind arguments to those provided to the bound function.

The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for partially applied arguments.

Note: Unlike native Function#bind this method does not set the "length" property of bound functions.

param

The function to bind.

param

The this binding of func.

param

The arguments to be partially applied.

returns

Returns the new bound function.

bindKey

Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments to those provided to the bound function.

This method differs from _.bind by allowing bound functions to reference methods that may be redefined or don’t yet exist. See Peter Michaux’s article for more details.

The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for partially applied arguments.

param

The object the method belongs to.

param

The key of the method.

param

The arguments to be partially applied.

returns

Returns the new bound function.

memoize

memoize: object

Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with the this binding of the memoized function.

param

The function to have its output memoized.

param

The function to resolve the cache key.

returns

Returns the new memoizing function.

Type declaration

partial

partial: Partial

Creates a function that, when called, invokes func with any additional partial arguments prepended to those provided to the new function. This method is similar to _.bind except it does not alter the this binding.

param

The function to partially apply arguments to.

param

Arguments to be partially applied.

returns

The new partially applied function.

partialRight

partialRight: PartialRight

This method is like _.partial except that partial arguments are appended to those provided to the new function.

param

The function to partially apply arguments to.

param

Arguments to be partially applied.

returns

The new partially applied function.

templateSettings

templateSettings: TemplateSettings

By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby (ERB). Change the following template settings to use alternative delimiters.

Methods

add

  • add(augend: number, addend: number): number
  • Adds two numbers.

    Parameters

    • augend: number

      The first number to add.

    • addend: number

      The second number to add.

    Returns number

    Returns the sum.

after

  • after<TFunc>(n: number, func: TFunc): TFunc
  • The opposite of _.before; this method creates a function that invokes func once it’s called n or more times.

    Type parameters

    • TFunc: Function

    Parameters

    • n: number

      The number of calls before func is invoked.

    • func: TFunc

      The function to restrict.

    Returns TFunc

    Returns the new restricted function.

ary

  • ary<TResult>(func: Function, n?: number): TResult
  • ary<T, TResult>(func: T, n?: number): TResult
  • Creates a function that accepts up to n arguments ignoring any additional arguments.

    Type parameters

    • TResult: Function

    Parameters

    • func: Function

      The function to cap arguments for.

    • Optional n: number

      The arity cap.

    Returns TResult

    Returns the new function.

  • Type parameters

    • T: Function

    • TResult: Function

    Parameters

    • func: T
    • Optional n: number

    Returns TResult

assign

  • assign<TObject, TSource, TResult>(object: TObject, source: TSource): TResult
  • assign<TObject, TSource1, TSource2, TResult>(object: TObject, source1: TSource1, source2: TSource2): TResult
  • assign<TObject, TSource1, TSource2, TSource3, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TResult
  • assign<TObject, TSource1, TSource2, TSource3, TSource4, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TResult
  • assign<TObject>(object: TObject): TObject
  • assign<TObject, TResult>(object: TObject, ...otherArgs: any[]): TResult
  • Assigns own enumerable 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.

    static
    memberof

    _

    category

    Object

    example

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

    function Bar() { this.e = 5; }

    Foo.prototype.d = 4; Bar.prototype.f = 6;

    _.assign({ 'a': 1 }, new Foo, new Bar); // => { 'a': 1, 'c': 3, 'e': 5 }

    Type parameters

    • TObject: __type

    • TSource: __type

    • TResult: __type

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TResult

    Returns object.

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2

    Returns TResult

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3

    Returns TResult

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TSource4: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4

    Returns TResult

  • see

    _.assign

    Type parameters

    • TObject: __type

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assign

    Type parameters

    • TObject: __type

    • TResult: __type

    Parameters

    • object: TObject
    • Rest ...otherArgs: any[]

    Returns TResult

assignIn

  • assignIn<TObject, TSource, TResult>(object: TObject, source: TSource): TResult
  • assignIn<TObject, TSource1, TSource2, TResult>(object: TObject, source1: TSource1, source2: TSource2): TResult
  • assignIn<TObject, TSource1, TSource2, TSource3, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TResult
  • assignIn<TObject, TSource1, TSource2, TSource3, TSource4, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TResult
  • assignIn<TObject>(object: TObject): TObject
  • assignIn<TObject, TResult>(object: TObject, ...otherArgs: any[]): TResult
  • This method is like _.assign except that it iterates over own and inherited source properties.

    Note: This method mutates object.

    static
    memberof

    _

    alias

    extend

    category

    Object

    example

    function Foo() { this.b = 2; }

    function Bar() { this.d = 4; }

    Foo.prototype.c = 3; Bar.prototype.e = 5;

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

    Type parameters

    • TObject: __type

    • TSource: __type

    • TResult: __type

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TResult

    Returns object.

  • see

    assignIn

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2

    Returns TResult

  • see

    assignIn

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3

    Returns TResult

  • see

    assignIn

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TSource4: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4

    Returns TResult

  • see

    _.assignIn

    Type parameters

    • TObject: __type

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignIn

    Type parameters

    • TObject: __type

    • TResult: __type

    Parameters

    • object: TObject
    • Rest ...otherArgs: any[]

    Returns TResult

assignInWith

  • assignInWith<TObject, TSource, TResult>(object: TObject, source: TSource, customizer: AssignCustomizer): TResult
  • assignInWith<TObject, TSource1, TSource2, TResult>(object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer): TResult
  • assignInWith<TObject, TSource1, TSource2, TSource3, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer): TResult
  • assignInWith<TObject, TSource1, TSource2, TSource3, TSource4, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer): TResult
  • assignInWith<TObject>(object: TObject): TObject
  • assignInWith<TObject, TResult>(object: TObject, ...otherArgs: any[]): TResult
  • This method is like _.assignIn except that it accepts customizer which is invoked to produce the assigned values. If customizer returns undefined assignment is handled by the method instead. The customizer is invoked with five arguments: (objValue, srcValue, key, object, source).

    Note: This method mutates object.

    static
    memberof

    _

    alias

    extendWith

    category

    Object

    example

    function customizer(objValue, srcValue) { return _.isUndefined(objValue) ? srcValue : objValue; }

    var defaults = .partialRight(.assignInWith, customizer);

    defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); // => { 'a': 1, 'b': 2 }

    Type parameters

    • TObject: __type

    • TSource: __type

    • TResult: __type

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • customizer: AssignCustomizer

    Returns TResult

    Returns object.

  • see

    assignInWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • customizer: AssignCustomizer

    Returns TResult

  • see

    assignInWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • customizer: AssignCustomizer

    Returns TResult

  • see

    assignInWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TSource4: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4
    • customizer: AssignCustomizer

    Returns TResult

  • see

    _.assignInWith

    Type parameters

    • TObject: __type

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignInWith

    Type parameters

    • TObject: __type

    • TResult: __type

    Parameters

    • object: TObject
    • Rest ...otherArgs: any[]

    Returns TResult

assignWith

  • assignWith<TObject, TSource, TResult>(object: TObject, source: TSource, customizer: AssignCustomizer): TResult
  • assignWith<TObject, TSource1, TSource2, TResult>(object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer): TResult
  • assignWith<TObject, TSource1, TSource2, TSource3, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer): TResult
  • assignWith<TObject, TSource1, TSource2, TSource3, TSource4, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer): TResult
  • assignWith<TObject>(object: TObject): TObject
  • assignWith<TObject, TResult>(object: TObject, ...otherArgs: any[]): TResult
  • This method is like _.assign except that it accepts customizer which is invoked to produce the assigned values. If customizer returns undefined assignment is handled by the method instead. The customizer is invoked with five arguments: (objValue, srcValue, key, object, source).

    Note: This method mutates object.

    static
    memberof

    _

    category

    Object

    example

    function customizer(objValue, srcValue) { return _.isUndefined(objValue) ? srcValue : objValue; }

    var defaults = .partialRight(.assignWith, customizer);

    defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); // => { 'a': 1, 'b': 2 }

    Type parameters

    • TObject: __type

    • TSource: __type

    • TResult: __type

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • customizer: AssignCustomizer

    Returns TResult

    Returns object.

  • see

    assignWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • customizer: AssignCustomizer

    Returns TResult

  • see

    assignWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • customizer: AssignCustomizer

    Returns TResult

  • see

    assignWith

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TSource4: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4
    • customizer: AssignCustomizer

    Returns TResult

  • see

    _.assignWith

    Type parameters

    • TObject: __type

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignWith

    Type parameters

    • TObject: __type

    • TResult: __type

    Parameters

    • object: TObject
    • Rest ...otherArgs: any[]

    Returns TResult

at

  • at<T>(collection: List<T> | Dictionary<T>, ...props: (string | number | (string | number)[])[]): T[]
  • Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be specified as individual arguments or as arrays of keys.

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>

      The collection to iterate over.

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

      The property names or indexes of elements to pick, specified individually or in arrays.

    Returns T[]

    Returns the new array of picked elements.

attempt

  • attempt<TResult>(func: function, ...args: any[]): TResult | 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.

    Type parameters

    • TResult

    Parameters

    • func: function

      The function to attempt.

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

          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult | Error

    Returns the func result or error object.

before

  • before<TFunc>(n: number, func: TFunc): TFunc
  • Creates a function that invokes func, with the this binding and arguments of the created function, while it’s called less than n times. Subsequent calls to the created function return the result of the last func invocation.

    Type parameters

    • TFunc: Function

    Parameters

    • n: number

      The number of calls at which func is no longer invoked.

    • func: TFunc

      The function to restrict.

    Returns TFunc

    Returns the new restricted function.

bindAll

  • bindAll<T>(object: T, ...methodNames: (string | string[])[]): T
  • Binds methods of an object to the object itself, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided all enumerable function properties, own and inherited, of object are bound.

    Note: This method does not set the "length" property of bound functions.

    Type parameters

    • T

    Parameters

    • object: T

      The object to bind and assign the bound methods to.

    • Rest ...methodNames: (string | string[])[]

      The object method names to bind, specified as individual method names or arrays of method names.

    Returns T

    Returns object.

camelCase

  • camelCase(string?: string): string
  • Converts string to camel case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the camel cased string.

capitalize

  • capitalize(string?: string): string
  • Converts the first character of string to upper case and the remaining to lower case.

    Parameters

    • Optional string: string

      The string to capitalize.

    Returns string

    Returns the capitalized string.

ceil

  • ceil(n: number, precision?: number): number
  • Calculates n rounded up to precision.

    Parameters

    • n: number

      The number to round up.

    • Optional precision: number

      The precision to round up to.

    Returns number

    Returns the rounded up number.

chain

  • Creates a lodash object that wraps value with explicit method chaining enabled.

    Parameters

    • value: number

      The value to wrap.

    Returns LoDashExplicitWrapper<number>

    Returns the new lodash wrapper instance.

  • Parameters

    • value: string

    Returns LoDashExplicitWrapper<string>

  • Parameters

    • value: boolean

    Returns LoDashExplicitWrapper<boolean>

  • Type parameters

    • T

    Parameters

    • value: T[]

    Returns LoDashExplicitArrayWrapper<T>

  • Type parameters

    • T: __type

    Parameters

    • value: T

    Returns LoDashExplicitObjectWrapper<T>

  • Parameters

    • value: any

    Returns LoDashExplicitWrapper<any>

chunk

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to process.

    • Optional size: number

      The length of each chunk.

    Returns T[][]

    Returns the new array containing chunks.

clamp

  • clamp(number: number, lower: number, upper: number): number
  • Clamps number within the inclusive lower and upper bounds.

    static
    memberof

    _

    category

    Number

    example

    _.clamp(-10, -5, 5); // => -5

    _.clamp(10, -5, 5); // => 5

    Parameters

    • number: number

      The number to clamp.

    • lower: number
    • upper: number

      The upper bound.

    Returns number

    Returns the clamped number.

clone

  • clone<T>(value: T): T
  • clone<T>(value: T, customizer: function): 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, regexes, sets, strings, symbols, and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps.

    static
    memberof

    _

    category

    Lang

    example

    var objects = [{ 'a': 1 }, { 'b': 2 }];

    var 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.

  • 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, regexes, sets, strings, symbols, and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps.

    static
    memberof

    _

    category

    Lang

    example

    var objects = [{ 'a': 1 }, { 'b': 2 }];

    var shallow = _.clone(objects); console.log(shallow[0] === objects[0]); // => true

    Type parameters

    • T

    Parameters

    • value: T

      The value to clone.

    • customizer: function
        • (value: any): any
        • Parameters

          • value: any

          Returns any

    Returns T

    Returns the cloned value.

cloneDeep

  • cloneDeep<T>(value: T): T
  • cloneDeep<T>(value: T, customizer: function): T
  • This method is like _.clone except that it recursively clones value.

    static
    memberof

    _

    category

    Lang

    example

    var objects = [{ 'a': 1 }, { 'b': 2 }];

    var 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.

  • Creates a deep clone of value. If customizer is provided it’s invoked to produce the cloned values. If customizer returns undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with up to three argument; (value [, index|key, object]). Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments objects and objects created by constructors other than Object are cloned to plain Object objects. An empty object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps.

    Type parameters

    • T

    Parameters

    • value: T

      The value to deep clone.

    • customizer: function

      The function to customize cloning values.

        • (value: any): any
        • Parameters

          • value: any

          Returns any

    Returns T

    Returns the deep cloned value.

compact

  • compact<T>(array?: List<T>): T[]
  • Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are falsey.

    Type parameters

    • T

    Parameters

    • Optional array: List<T>

      The array to compact.

    Returns T[]

    (Array) Returns the new array of filtered values.

concat

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

    static
    memberof

    _

    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 ...values: (T[] | List<T>)[]

    Returns T[]

    Returns the new concatenated array.

constant

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

    Type parameters

    • T

    Parameters

    • value: T

      The value to return from the new function.

    Returns function

    Returns the new function.

      • (): T
      • Returns T

countBy

  • Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for iteratee the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<number>

    Returns the composed aggregate object.

  • see

    _.countBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<number>

  • see

    _.countBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<number>

  • see

    _.countBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<number>

  • see

    _.countBy

    Type parameters

    • W

    • T

    Parameters

    Returns Dictionary<number>

  • see

    _.countBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<number>

create

  • create<T, U>(prototype: T, properties?: U): T & U
  • Creates an object that inherits from the given prototype object. If a properties object is provided its own enumerable properties are assigned to the created object.

    Type parameters

    • T: Object

    • U: Object

    Parameters

    • prototype: T

      The object to inherit from.

    • Optional properties: U

      The properties to assign to the object.

    Returns T & U

    Returns the new object.

createCallback

  • createCallback(func: string, thisArg?: any, argCount?: number): function
  • createCallback(func: Dictionary<any>, thisArg?: any, argCount?: number): function
  • Produces a callback bound to an optional thisArg. If func is a property name the created callback will return the property value for a given element. If func is an object the created callback will return true for elements that contain the equivalent object properties, otherwise it will return false.

    Parameters

    • func: string

      The value to convert to a callback.

    • Optional thisArg: any

      The this binding of the created callback.

    • Optional argCount: number

      The number of arguments the callback accepts.

    Returns function

    A callback function.

      • (): any
      • Returns any

  • see

    _.createCallback

    Parameters

    • func: Dictionary<any>
    • Optional thisArg: any
    • Optional argCount: number

    Returns function

      • (): boolean
      • Returns boolean

curry

  • curry<T1, R>(func: function): CurriedFunction1<T1, R>
  • curry<T1, T2, R>(func: function): CurriedFunction2<T1, T2, R>
  • curry<T1, T2, T3, R>(func: function): CurriedFunction3<T1, T2, T3, R>
  • curry<T1, T2, T3, T4, R>(func: function): CurriedFunction4<T1, T2, T3, T4, R>
  • curry<T1, T2, T3, T4, T5, R>(func: function): CurriedFunction5<T1, T2, T3, T4, T5, R>
  • curry<TResult>(func: Function, arity?: number): TResult
  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • T1

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1): R
        • Parameters

          • t1: T1

          Returns R

    Returns CurriedFunction1<T1, R>

    Returns the new curried function.

  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • T1

    • T2

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2): R
        • Parameters

          • t1: T1
          • t2: T2

          Returns R

    Returns CurriedFunction2<T1, T2, R>

    Returns the new curried function.

  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • T1

    • T2

    • T3

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3

          Returns R

    Returns CurriedFunction3<T1, T2, T3, R>

    Returns the new curried function.

  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3, t4: T4): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3
          • t4: T4

          Returns R

    Returns CurriedFunction4<T1, T2, T3, T4, R>

    Returns the new curried function.

  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3
          • t4: T4
          • t5: T5

          Returns R

    Returns CurriedFunction5<T1, T2, T3, T4, T5, R>

    Returns the new curried function.

  • Creates a function that accepts one or more arguments of func that when called either invokes func returning its result, if all func arguments have been provided, or returns a function that accepts one or more of the remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient.

    Type parameters

    • TResult: Function

    Parameters

    • func: Function

      The function to curry.

    • Optional arity: number

      The arity of func.

    Returns TResult

    Returns the new curried function.

curryRight

  • curryRight<T1, R>(func: function): CurriedFunction1<T1, R>
  • curryRight<T1, T2, R>(func: function): CurriedFunction2<T2, T1, R>
  • curryRight<T1, T2, T3, R>(func: function): CurriedFunction3<T3, T2, T1, R>
  • curryRight<T1, T2, T3, T4, R>(func: function): CurriedFunction4<T4, T3, T2, T1, R>
  • curryRight<T1, T2, T3, T4, T5, R>(func: function): CurriedFunction5<T5, T4, T3, T2, T1, R>
  • curryRight<TResult>(func: Function, arity?: number): TResult
  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • T1

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1): R
        • Parameters

          • t1: T1

          Returns R

    Returns CurriedFunction1<T1, R>

    Returns the new curried function.

  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • T1

    • T2

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2): R
        • Parameters

          • t1: T1
          • t2: T2

          Returns R

    Returns CurriedFunction2<T2, T1, R>

    Returns the new curried function.

  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • T1

    • T2

    • T3

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3

          Returns R

    Returns CurriedFunction3<T3, T2, T1, R>

    Returns the new curried function.

  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3, t4: T4): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3
          • t4: T4

          Returns R

    Returns CurriedFunction4<T4, T3, T2, T1, R>

    Returns the new curried function.

  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • R

    Parameters

    • func: function

      The function to curry.

        • (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R
        • Parameters

          • t1: T1
          • t2: T2
          • t3: T3
          • t4: T4
          • t5: T5

          Returns R

    Returns CurriedFunction5<T5, T4, T3, T2, T1, R>

    Returns the new curried function.

  • This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

    Type parameters

    • TResult: Function

    Parameters

    • func: Function

      The function to curry.

    • Optional arity: number

      The arity of func.

    Returns TResult

    Returns the new curried function.

debounce

  • Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked. The debounced function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. 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 the debounced function is invoked more than once during the wait timeout.

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

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to debounce.

    • Optional wait: number

      The number of milliseconds to delay.

    • Optional options: DebounceSettings

      The options object.

    Returns T & Cancelable

    Returns the new debounced function.

deburr

  • deburr(string?: string): string
  • Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining diacritical marks.

    Parameters

    • Optional string: string

      The string to deburr.

    Returns string

    Returns the deburred string.

defaults

  • defaults<Obj, TResult>(object: Obj, ...sources: __type[]): TResult
  • defaults<Obj, S1, TResult>(object: Obj, source1: S1, ...sources: __type[]): TResult
  • defaults<Obj, S1, S2, TResult>(object: Obj, source1: S1, source2: S2, ...sources: __type[]): TResult
  • defaults<Obj, S1, S2, S3, TResult>(object: Obj, source1: S1, source2: S2, source3: S3, ...sources: __type[]): TResult
  • defaults<Obj, S1, S2, S3, S4, TResult>(object: Obj, source1: S1, source2: S2, source3: S3, source4: S4, ...sources: __type[]): TResult
  • defaults<TResult>(object: __type, ...sources: __type[]): TResult
  • Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to undefined. Once a property is set, additional values of the same property are ignored.

    Note: This method mutates object.

    Type parameters

    • Obj: __type

    • TResult: __type

    Parameters

    • object: Obj

      The destination object.

    • Rest ...sources: __type[]

      The source objects.

    Returns TResult

    The destination object.

  • see

    _.defaults

    Type parameters

    • Obj: __type

    • S1: __type

    • TResult: __type

    Parameters

    • object: Obj
    • source1: S1
    • Rest ...sources: __type[]

    Returns TResult

  • see

    _.defaults

    Type parameters

    • Obj: __type

    • S1: __type

    • S2: __type

    • TResult: __type

    Parameters

    • object: Obj
    • source1: S1
    • source2: S2
    • Rest ...sources: __type[]

    Returns TResult

  • see

    _.defaults

    Type parameters

    • Obj: __type

    • S1: __type

    • S2: __type

    • S3: __type

    • TResult: __type

    Parameters

    • object: Obj
    • source1: S1
    • source2: S2
    • source3: S3
    • Rest ...sources: __type[]

    Returns TResult

  • see

    _.defaults

    Type parameters

    • Obj: __type

    • S1: __type

    • S2: __type

    • S3: __type

    • S4: __type

    • TResult: __type

    Parameters

    • object: Obj
    • source1: S1
    • source2: S2
    • source3: S3
    • source4: S4
    • Rest ...sources: __type[]

    Returns TResult

  • see

    _.defaults

    Type parameters

    • TResult: __type

    Parameters

    • object: __type
    • Rest ...sources: __type[]

    Returns TResult

defaultsDeep

  • defaultsDeep<T, TResult>(object: T, ...sources: any[]): TResult
  • This method is like _.defaults except that it recursively assigns default properties.

    Type parameters

    • T

    • TResult

    Parameters

    • object: T

      The destination object.

    • Rest ...sources: any[]

      The source objects.

    Returns TResult

    Returns object.

defer

  • defer<T>(func: T, ...args: any[]): number
  • Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to func when it’s invoked.

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to defer.

    • Rest ...args: any[]

      The arguments to invoke the function with.

    Returns number

    Returns the timer id.

delay

  • delay<T>(func: T, wait: number, ...args: any[]): number
  • Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked.

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to delay.

    • wait: number

      The number of milliseconds to delay invocation.

    • Rest ...args: any[]

      The arguments to invoke the function with.

    Returns number

    Returns the timer id.

difference

  • difference<T>(array: T[] | List<T>, ...values: Array<T[] | List<T>>): T[]
  • Creates an array of unique array values not included in the other provided arrays using SameValueZero for equality comparisons.

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>

      The array to inspect.

    • Rest ...values: Array<T[] | List<T>>

      The arrays of values to exclude.

    Returns T[]

    Returns the new array of filtered values.

differenceBy

  • differenceBy<T>(array: T[] | List<T>, values?: T[] | List<T>, iteratee?: function | string): T[]
  • differenceBy<T, W>(array: T[] | List<T>, values?: T[] | List<T>, iteratee?: W): T[]
  • differenceBy<T>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, iteratee?: function | string): T[]
  • differenceBy<T, W>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, iteratee?: W): T[]
  • differenceBy<T>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, iteratee?: function | string): T[]
  • differenceBy<T, W>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, iteratee?: W): T[]
  • differenceBy<T, W>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, values4?: T[] | List<T>, iteratee?: W): T[]
  • differenceBy<T>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, values4?: T[] | List<T>, iteratee?: function | string): T[]
  • differenceBy<T>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, values4?: T[] | List<T>, values5?: T[] | List<T>, iteratee?: function | string): T[]
  • differenceBy<T, W>(array: T[] | List<T>, values1?: T[] | List<T>, values2?: T[] | List<T>, values3?: T[] | List<T>, values4?: T[] | List<T>, values5?: T[] | List<T>, iteratee?: W): T[]
  • differenceBy<T>(array: T[] | List<T>, ...values: any[]): T[]
  • 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 uniqueness is computed. The iteratee is invoked with one argument: (value).

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>

      The array to inspect.

    • Optional values: T[] | List<T>

      The values to exclude.

    • Optional iteratee: function | string

      The iteratee invoked per element.

    Returns T[]

    Returns the new array of filtered values.

  • see

    _.differenceBy

    Type parameters

    • T

    • W: Object

    Parameters

    • array: T[] | List<T>
    • Optional values: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional iteratee: function | string

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    • W: Object

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional iteratee: function | string

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    • W: Object

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    • W: Object

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional values4: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional values4: T[] | List<T>
    • Optional iteratee: function | string

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional values4: T[] | List<T>
    • Optional values5: T[] | List<T>
    • Optional iteratee: function | string

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    • W: Object

    Parameters

    • array: T[] | List<T>
    • Optional values1: T[] | List<T>
    • Optional values2: T[] | List<T>
    • Optional values3: T[] | List<T>
    • Optional values4: T[] | List<T>
    • Optional values5: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.differenceBy

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>
    • Rest ...values: any[]

    Returns T[]

differenceWith

  • differenceWith(array: any[] | List<any>, ...values: any[]): any[]
  • Creates an array of unique array values not included in the other provided arrays using SameValueZero for equality comparisons.

    static
    memberof

    _

    category

    Array

    example

    _.difference([3, 2, 1], [4, 2]); // => [3, 1]

    Parameters

    • array: any[] | List<any>

      The array to inspect.

    • Rest ...values: any[]

    Returns any[]

    Returns the new array of filtered values.

drop

  • drop<T>(array: T[] | List<T>, n?: number): T[]
  • Creates a slice of array with n elements dropped from the beginning.

    Type parameters

    • T

    Parameters

    • array: T[] | List<T>

      The array to query.

    • Optional n: number

      The number of elements to drop.

    Returns T[]

    Returns the slice of array.

dropRight

  • dropRight<T>(array: List<T>, n?: number): T[]
  • Creates a slice of array with n elements dropped from the end.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    • Optional n: number

      The number of elements to drop.

    Returns T[]

    Returns the slice of array.

dropRightWhile

  • dropRightWhile<TValue>(array: List<TValue>, predicate?: ListIterator<TValue, boolean>, thisArg?: any): TValue[]
  • dropRightWhile<TValue>(array: List<TValue>, predicate?: string, thisArg?: any): TValue[]
  • dropRightWhile<TWhere, TValue>(array: List<TValue>, predicate?: TWhere): TValue[]
  • Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that match the properties of the given object, else false.

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>

      The array to query.

    • Optional predicate: ListIterator<TValue, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns TValue[]

    Returns the slice of array.

  • see

    _.dropRightWhile

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: string
    • Optional thisArg: any

    Returns TValue[]

  • see

    _.dropRightWhile

    Type parameters

    • TWhere

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: TWhere

    Returns TValue[]

dropWhile

  • dropWhile<TValue>(array: List<TValue>, predicate?: ListIterator<TValue, boolean>, thisArg?: any): TValue[]
  • dropWhile<TValue>(array: List<TValue>, predicate?: string, thisArg?: any): TValue[]
  • dropWhile<TWhere, TValue>(array: List<TValue>, predicate?: TWhere): TValue[]
  • Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>

      The array to query.

    • Optional predicate: ListIterator<TValue, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns TValue[]

    Returns the slice of array.

  • see

    _.dropWhile

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: string
    • Optional thisArg: any

    Returns TValue[]

  • see

    _.dropWhile

    Type parameters

    • TWhere

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: TWhere

    Returns TValue[]

each

  • see

    _.forEach

    Type parameters

    • T

    Parameters

    • collection: T[]
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns T[]

  • see

    _.forEach

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns List<T>

  • see

    _.forEach

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.forEach

    Type parameters

    • T: __type

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArgs: any

    Returns T

  • see

    _.forEach

    Type parameters

    • T: __type

    • TValue

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<TValue, any>
    • Optional thisArgs: any

    Returns T

eachRight

  • see

    _.forEachRight

    Type parameters

    • T

    Parameters

    • collection: T[]
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns T[]

  • see

    _.forEachRight

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns List<T>

  • see

    _.forEachRight

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.forEachRight

    Type parameters

    • T: __type

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArgs: any

    Returns T

  • see

    _.forEachRight

    Type parameters

    • T: __type

    • TValue

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<TValue, any>
    • Optional thisArgs: any

    Returns T

endsWith

  • endsWith(string?: string, target?: string, position?: number): boolean
  • Checks if string ends with the given target string.

    Parameters

    • Optional string: string

      The string to search.

    • Optional target: string

      The string to search for.

    • Optional position: number

      The position to search from.

    Returns boolean

    Returns true if string ends with target, else false.

eq

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

    static
    memberof

    _

    category

    Lang

    example

    var object = { 'user': 'fred' }; var other = { 'user': 'fred' };

    _.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.

escape

  • escape(string?: string): string
  • Converts the characters "&", "<", ">", '"', "'", and "`" in string to their corresponding HTML entities.

    Note: No other characters are escaped. To escape additional characters use a third-party library like he.

    hough the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s article (under "semi-related fun fact") for more details.

    Backticks are escaped because in IE < 9, they can break out of attribute values or HTML comments. See #59,

    #102, #108, and #133 of the HTML5 Security Cheatsheet for more details.

    When working with HTML you should always quote attribute values to reduce XSS vectors.

    Parameters

    • Optional string: string

      The string to escape.

    Returns string

    Returns the escaped string.

escapeRegExp

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

    Parameters

    • Optional string: string

      The string to escape.

    Returns string

    Returns the escaped string.

every

  • 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).

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    Returns boolean

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

  • see

    _.every

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.every

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.every

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.every

    Type parameters

    • TObject: __type

    • T

    Parameters

    Returns boolean

extend

  • extend<TObject, TSource, TResult>(object: TObject, source: TSource, customizer?: AssignCustomizer, thisArg?: any): TResult
  • extend<TObject, TSource1, TSource2, TResult>(object: TObject, source1: TSource1, source2: TSource2, customizer?: AssignCustomizer, thisArg?: any): TResult
  • extend<TObject, TSource1, TSource2, TSource3, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer?: AssignCustomizer, thisArg?: any): TResult
  • extend<TObject, TSource1, TSource2, TSource3, TSource4, TResult>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer?: AssignCustomizer, thisArg?: any): TResult
  • extend<TObject>(object: TObject): TObject
  • extend<TObject, TResult>(object: TObject, ...otherArgs: any[]): TResult
  • see

    assign

    Type parameters

    • TObject: __type

    • TSource: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source: TSource
    • Optional customizer: AssignCustomizer
    • Optional thisArg: any

    Returns TResult

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • Optional customizer: AssignCustomizer
    • Optional thisArg: any

    Returns TResult

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • Optional customizer: AssignCustomizer
    • Optional thisArg: any

    Returns TResult

  • see

    assign

    Type parameters

    • TObject: __type

    • TSource1: __type

    • TSource2: __type

    • TSource3: __type

    • TSource4: __type

    • TResult: __type

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4
    • Optional customizer: AssignCustomizer
    • Optional thisArg: any

    Returns TResult

  • see

    _.assign

    Type parameters

    • TObject: __type

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assign

    Type parameters

    • TObject: __type

    • TResult: __type

    Parameters

    • object: TObject
    • Rest ...otherArgs: any[]

    Returns TResult

fill

  • fill<T>(array: any[], value: T, start?: number, end?: number): T[]
  • fill<T>(array: List<any>, value: T, start?: number, end?: number): List<T>
  • Fills elements of array with value from start up to, but not including, end.

    Note: This method mutates array.

    Type parameters

    • T

    Parameters

    • array: any[]

      The array to fill.

    • value: T

      The value to fill array with.

    • Optional start: number

      The start position.

    • Optional end: number

      The end position.

    Returns T[]

    Returns array.

  • see

    _.fill

    Type parameters

    • T

    Parameters

    • array: List<any>
    • value: T
    • Optional start: number
    • Optional end: number

    Returns List<T>

filter

  • filter<T>(collection: List<T>, predicate?: ListIterator<T, boolean>, thisArg?: any): T[]
  • filter<T>(collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean>, thisArg?: any): T[]
  • filter(collection: string, predicate?: StringIterator<boolean>, thisArg?: any): string[]
  • filter<T>(collection: List<T> | Dictionary<T>, predicate: string, thisArg?: any): T[]
  • filter<W, T>(collection: List<T> | Dictionary<T>, predicate: W): T[]
  • Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns T[]

    Returns the new filtered array.

  • see

    _.filter

    Type parameters

    • T

    Parameters

    Returns T[]

  • see

    _.filter

    Parameters

    • collection: string
    • Optional predicate: StringIterator<boolean>
    • Optional thisArg: any

    Returns string[]

  • see

    _.filter

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>
    • predicate: string
    • Optional thisArg: any

    Returns T[]

  • see

    _.filter

    Type parameters

    • W: __type

    • T

    Parameters

    Returns T[]

find

  • Iterates over elements of collection, returning the first element predicate returns truthy for. The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to search.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns T

    Returns the matched element, else undefined.

  • see

    _.find

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.find

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>
    • Optional predicate: string
    • Optional thisArg: any

    Returns T

  • see

    _.find

    Type parameters

    • TObject: __type

    • T

    Parameters

    Returns T

findIndex

  • findIndex<T>(array: List<T>, predicate?: ListIterator<T, boolean>, thisArg?: any): number
  • findIndex<T>(array: List<T>, predicate?: string, thisArg?: any): number
  • findIndex<W, T>(array: List<T>, predicate?: W): number
  • This method is like _.find except that it returns the index of the first element predicate returns truthy for instead of the element itself.

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to search.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns number

    Returns the index of the found element, else -1.

  • see

    _.findIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • Optional predicate: string
    • Optional thisArg: any

    Returns number

  • see

    _.findIndex

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • Optional predicate: W

    Returns number

findKey

  • findKey<TValues, TObject>(object: TObject, predicate?: DictionaryIterator<TValues, boolean>, thisArg?: any): string
  • findKey<TObject>(object: TObject, predicate?: ObjectIterator<any, boolean>, thisArg?: any): string
  • findKey<TObject>(object: TObject, predicate?: string, thisArg?: any): string
  • findKey<TWhere, TObject>(object: TObject, predicate?: TWhere): string
  • This method is like _.find except that it returns the key of the first element predicate returns truthy for instead of the element itself.

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • TValues

    • TObject

    Parameters

    • object: TObject

      The object to search.

    • Optional predicate: DictionaryIterator<TValues, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns string

    Returns the key of the matched element, else undefined.

  • see

    _.findKey

    Type parameters

    • TObject

    Parameters

    • object: TObject
    • Optional predicate: ObjectIterator<any, boolean>
    • Optional thisArg: any

    Returns string

  • see

    _.findKey

    Type parameters

    • TObject

    Parameters

    • object: TObject
    • Optional predicate: string
    • Optional thisArg: any

    Returns string

  • see

    _.findKey

    Type parameters

    Parameters

    • object: TObject
    • Optional predicate: TWhere

    Returns string

findLast

  • findLast<T>(collection: Array<T>, callback: ListIterator<T, boolean>, thisArg?: any): T
  • findLast<T>(collection: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T
  • findLast<T>(collection: Dictionary<T>, callback: DictionaryIterator<T, boolean>, thisArg?: any): T
  • findLast<W, T>(collection: Array<T>, whereValue: W): T
  • findLast<W, T>(collection: List<T>, whereValue: W): T
  • findLast<W, T>(collection: Dictionary<T>, whereValue: W): T
  • findLast<T>(collection: Array<T>, pluckValue: string): T
  • findLast<T>(collection: List<T>, pluckValue: string): T
  • findLast<T>(collection: Dictionary<T>, pluckValue: string): T
  • This method is like _.find except that it iterates over elements of a collection from right to left.

    Type parameters

    • T

    Parameters

    • collection: Array<T>

      Searches for a value in this list.

    • callback: ListIterator<T, boolean>

      The function called per iteration.

    • Optional thisArg: any

      The this binding of callback.

    Returns T

    The found element, else undefined.

  • see

    _.find

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.find

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.find

    Type parameters

    • W

    • T

    Parameters

    • collection: Array<T>
    • whereValue: W

    Returns T

  • see

    _.find

    Type parameters

    • W

    • T

    Parameters

    • collection: List<T>
    • whereValue: W

    Returns T

  • see

    _.find

    Type parameters

    • W

    • T

    Parameters

    Returns T

  • see

    _.find

    Type parameters

    • T

    Parameters

    • collection: Array<T>
    • pluckValue: string

    Returns T

  • see

    _.find

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • pluckValue: string

    Returns T

  • see

    _.find

    Type parameters

    • T

    Parameters

    Returns T

findLastIndex

  • findLastIndex<T>(array: List<T>, predicate?: ListIterator<T, boolean>, thisArg?: any): number
  • findLastIndex<T>(array: List<T>, predicate?: string, thisArg?: any): number
  • findLastIndex<W, T>(array: List<T>, predicate?: W): number
  • This method is like _.findIndex except that it iterates over elements of collection from right to left.

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to search.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The function invoked per iteration.

    Returns number

    Returns the index of the found element, else -1.

  • see

    _.findLastIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • Optional predicate: string
    • Optional thisArg: any

    Returns number

  • see

    _.findLastIndex

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • Optional predicate: W

    Returns number

findLastKey

  • findLastKey<TValues, TObject>(object: TObject, predicate?: DictionaryIterator<TValues, boolean>, thisArg?: any): string
  • findLastKey<TObject>(object: TObject, predicate?: ObjectIterator<any, boolean>, thisArg?: any): string
  • findLastKey<TObject>(object: TObject, predicate?: string, thisArg?: any): string
  • findLastKey<TWhere, TObject>(object: TObject, predicate?: TWhere): string
  • This method is like _.findKey except that it iterates over elements of a collection in the opposite order.

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • TValues

    • TObject

    Parameters

    • object: TObject

      The object to search.

    • Optional predicate: DictionaryIterator<TValues, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns string

    Returns the key of the matched element, else undefined.

  • see

    _.findLastKey

    Type parameters

    • TObject

    Parameters

    • object: TObject
    • Optional predicate: ObjectIterator<any, boolean>
    • Optional thisArg: any

    Returns string

  • see

    _.findLastKey

    Type parameters

    • TObject

    Parameters

    • object: TObject
    • Optional predicate: string
    • Optional thisArg: any

    Returns string

  • see

    _.findLastKey

    Type parameters

    Parameters

    • object: TObject
    • Optional predicate: TWhere

    Returns string

first

  • first<T>(array: List<T>): T
  • see

    _.head

    Type parameters

    • T

    Parameters

    Returns T

flatMap

  • flatMap(array: any[] | List<any>, ...values: any[]): any[]
  • Creates an array of flattened values by running each element in array through iteratee and concating its result to the other mapped values. The iteratee is invoked with three arguments: (value, index|key, array).

    static
    memberof

    _

    category

    Array

    example

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

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

    Parameters

    • array: any[] | List<any>

      The array to iterate over.

    • Rest ...values: any[]

    Returns any[]

    Returns the new array.

flatten

  • Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only flattened a single level.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the new flattened array.

  • see

    _.flatten

    Type parameters

    • T

    Parameters

    • array: List<T | T[]>

    Returns T[]

  • see

    _.flatten

    Type parameters

    • T

    Parameters

    Returns RecursiveArray<T>

flattenDeep

  • Recursively flattens a nested array.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the new flattened array.

flip

  • flip<T>(func: T): T
  • Creates a function that invokes func with arguments reversed.

    static
    memberof

    _

    category

    Function

    example

    var flipped = _.flip(function() { return _.toArray(arguments); });

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

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to flip arguments for.

    Returns T

    Returns the new function.

floor

  • floor(n: number, precision?: number): number
  • Calculates n rounded down to precision.

    Parameters

    • n: number

      The number to round down.

    • Optional precision: number

      The precision to round down to.

    Returns number

    Returns the rounded down number.

flow

  • flow<TResult>(...funcs: Function[]): TResult
  • Creates a function that returns the result of invoking the provided functions with the this binding of the created function, where each successive invocation is supplied the return value of the previous.

    Type parameters

    • TResult: Function

    Parameters

    • Rest ...funcs: Function[]

      Functions to invoke.

    Returns TResult

    Returns the new function.

flowRight

  • flowRight<TResult>(...funcs: Function[]): TResult
  • This method is like _.flow except that it creates a function that invokes the provided functions from right to left.

    Type parameters

    • TResult: Function

    Parameters

    • Rest ...funcs: Function[]

      Functions to invoke.

    Returns TResult

    Returns the new function.

forEach

  • Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg and 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 _.forIn or _.forOwn may be used for object iteration.

    alias

    _.each

    Type parameters

    • T

    Parameters

    • collection: T[]

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns T[]

  • see

    _.forEach

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns List<T>

  • see

    _.forEach

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.forEach

    Type parameters

    • T: __type

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArgs: any

    Returns T

  • see

    _.forEach

    Type parameters

    • T: __type

    • TValue

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<TValue, any>
    • Optional thisArgs: any

    Returns T

forEachRight

  • This method is like _.forEach except that it iterates over elements of collection from right to left.

    alias

    _.eachRight

    Type parameters

    • T

    Parameters

    • collection: T[]

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, any>

      The function called per iteration.

    • Optional thisArg: any

      The this binding of callback.

    Returns T[]

  • see

    _.forEachRight

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns List<T>

  • see

    _.forEachRight

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.forEachRight

    Type parameters

    • T: __type

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArgs: any

    Returns T

  • see

    _.forEachRight

    Type parameters

    • T: __type

    • TValue

    Parameters

    • collection: T
    • Optional iteratee: ObjectIterator<TValue, any>
    • Optional thisArgs: any

    Returns T

forIn

  • Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

    Type parameters

    • T

    Parameters

    • object: Dictionary<T>

      The object to iterate over.

    • Optional iteratee: DictionaryIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns object.

  • see

    _.forIn

    Type parameters

    • T: __type

    Parameters

    • object: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArg: any

    Returns T

forInRight

  • This method is like _.forIn except that it iterates over properties of object in the opposite order.

    Type parameters

    • T

    Parameters

    • object: Dictionary<T>

      The object to iterate over.

    • Optional iteratee: DictionaryIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns object.

  • see

    _.forInRight

    Type parameters

    • T: __type

    Parameters

    • object: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArg: any

    Returns T

forOwn

  • Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

    Type parameters

    • T

    Parameters

    • object: Dictionary<T>

      The object to iterate over.

    • Optional iteratee: DictionaryIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns object.

  • see

    _.forOwn

    Type parameters

    • T: __type

    Parameters

    • object: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArg: any

    Returns T

forOwnRight

  • This method is like _.forOwn except that it iterates over properties of object in the opposite order.

    Type parameters

    • T

    Parameters

    • object: Dictionary<T>

      The object to iterate over.

    • Optional iteratee: DictionaryIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns object.

  • see

    _.forOwnRight

    Type parameters

    • T: __type

    Parameters

    • object: T
    • Optional iteratee: ObjectIterator<any, any>
    • Optional thisArg: any

    Returns T

fromPairs

  • fromPairs(array: any[] | List<any>): any[]
  • The inverse of _.toPairs; this method returns an object composed from key-value pairs.

    static
    memberof

    _

    category

    Array

    example

    _.fromPairs([['fred', 30], ['barney', 40]]); // => { 'fred': 30, 'barney': 40 }

    Parameters

    • array: any[] | List<any>

    Returns any[]

    Returns the new object.

functions

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

    static
    memberof

    _

    category

    Object

    example

    function Foo() { this.a = _.constant('a'); this.b = _.constant('b'); }

    Foo.prototype.c = _.constant('c');

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

    Type parameters

    • T: __type

    Parameters

    • object: any

      The object to inspect.

    Returns string[]

    Returns the new array of property names.

functionsIn

  • functionsIn<T>(object: any): string[]
  • Creates an array of function property names from own and inherited enumerable properties of object.

    static
    memberof

    _

    category

    Object

    example

    function Foo() { this.a = _.constant('a'); this.b = _.constant('b'); }

    Foo.prototype.c = _.constant('c');

    _.functionsIn(new Foo); // => ['a', 'b', 'c']

    Type parameters

    • T: __type

    Parameters

    • object: any

      The object to inspect.

    Returns string[]

    Returns the new array of property names.

get

  • get<TResult>(object: Object, path: string | number | boolean | Array<string | number | boolean>, defaultValue?: TResult): TResult
  • Gets the property value at path of object. If the resolved value is undefined the defaultValue is used in its place.

    Type parameters

    • TResult

    Parameters

    • object: Object

      The object to query.

    • path: string | number | boolean | Array<string | number | boolean>

      The path of the property to get.

    • Optional defaultValue: TResult

      The value returned if the resolved value is undefined.

    Returns TResult

    Returns the resolved value.

groupBy

  • Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is an array of the elements responsible for generating the key. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for iteratee the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    • TKey

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, TKey>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T[]>

    Returns the composed aggregate object.

  • see

    _.groupBy

    Type parameters

    • T

    Parameters

    • collection: List<any>
    • Optional iteratee: ListIterator<T, any>
    • Optional thisArg: any

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • T

    • TKey

    Parameters

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • T

    • TValue

    Parameters

    • collection: List<T> | Dictionary<T>
    • Optional iteratee: string
    • Optional thisArg: TValue

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>
    • Optional iteratee: string
    • Optional thisArg: any

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • TWhere

    • T

    Parameters

    Returns Dictionary<T[]>

  • see

    _.groupBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T[]>

gt

  • gt(value: any, other: any): boolean
  • Checks if value is greater than other.

    Parameters

    • value: any

      The value to compare.

    • other: any

      The other value to compare.

    Returns boolean

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

gte

  • gte(value: any, other: any): boolean
  • Checks if value is greater than or equal to other.

    Parameters

    • value: any

      The value to compare.

    • other: any

      The other value to compare.

    Returns boolean

    Returns true if value is greater than or equal to other, else false.

has

  • Checks if path is a direct property of object.

    static
    memberof

    _

    category

    Object

    example

    var object = { 'a': { 'b': { 'c': 3 } } }; var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });

    _.has(object, 'a'); // => true

    _.has(object, 'a.b.c'); // => true

    _.has(object, ['a', 'b', 'c']); // => true

    _.has(other, 'a'); // => false

    Type parameters

    • T: __type

    Parameters

    Returns boolean

    Returns true if path exists, else false.

hasIn

  • Checks if path is a direct or inherited property of object.

    static
    memberof

    _

    category

    Object

    example

    var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });

    _.hasIn(object, 'a'); // => true

    _.hasIn(object, 'a.b.c'); // => true

    _.hasIn(object, ['a', 'b', 'c']); // => true

    _.hasIn(object, 'b'); // => false

    Type parameters

    • T: __type

    Parameters

    Returns boolean

    Returns true if path exists, else false.

head

  • head<T>(array: List<T>): T
  • Gets the first element of array.

    alias

    _.first

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    Returns T

    Returns the first element of array.

identity

  • identity<T>(value?: T): T
  • This method returns the first argument provided to it.

    Type parameters

    • T

    Parameters

    • Optional value: T

      Any value.

    Returns T

    Returns value.

inRange

  • inRange(n: number, start: number, end: number): boolean
  • inRange(n: number, end: number): boolean
  • Checks if n is between start and up to but not including, end. If end is not specified it’s set to start with start then set to 0.

    Parameters

    • n: number

      The number to check.

    • start: number

      The start of the range.

    • end: number

      The end of the range.

    Returns boolean

    Returns true if n is in the range, else false.

  • see

    _.inRange

    Parameters

    • n: number
    • end: number

    Returns boolean

includes

  • includes<T>(collection: List<T> | Dictionary<T>, target: T, fromIndex?: number): boolean
  • includes(collection: string, target: string, fromIndex?: number): boolean
  • Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, it’s used as the offset from the end of collection.

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>

      The collection to search.

    • target: T

      The value to search for.

    • Optional fromIndex: number

      The index to search from.

    Returns boolean

    True if the target element is found, else false.

  • see

    _.includes

    Parameters

    • collection: string
    • target: string
    • Optional fromIndex: number

    Returns boolean

indexOf

  • indexOf<T>(array: List<T>, value: T, fromIndex?: boolean | number): number
  • Gets the index at which the first occurrence of value is found in array using SameValueZero for equality comparisons. If fromIndex is negative, it's used as the offset from the end of array. If array is sorted providing true for fromIndex performs a faster binary search.

    static
    memberof

    _

    category

    Array

    example

    _.indexOf([1, 2, 1, 2], 2); // => 1

    // using fromIndex _.indexOf([1, 2, 1, 2], 2, 2); // => 3

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to search.

    • value: T

      The value to search for.

    • Optional fromIndex: boolean | number

    Returns number

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

initial

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    Returns T[]

    Returns the slice of array.

intersection

  • intersection<T>(...arrays: (T[] | List<T>)[]): T[]
  • Creates an array of unique values that are included in all of the provided arrays using SameValueZero for equality comparisons.

    Type parameters

    • T

    Parameters

    • Rest ...arrays: (T[] | List<T>)[]

      The arrays to inspect.

    Returns T[]

    Returns the new array of shared values.

intersectionBy

  • intersectionBy(array: any[] | List<any>, ...values: any[]): any[]
  • 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 uniqueness is computed. The iteratee is invoked with one argument: (value).

    static
    memberof

    _

    category

    Array

    example

    _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); // => [2.1]

    // using the _.property iteratee shorthand _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 1 }]

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns the new array of shared values.

intersectionWith

  • intersectionWith(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.intersection except that it accepts comparator which is invoked to compare elements of arrays. The comparator is invoked with two arguments: (arrVal, othVal).

    static
    memberof

    _

    category

    Array

    example

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];

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

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns the new array of shared values.

invert

  • invert<T, TResult>(object: T, multiValue?: boolean): TResult
  • invert<TResult>(object: Object, multiValue?: boolean): TResult
  • 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 unless multiValue is true.

    Type parameters

    • T: __type

    • TResult: __type

    Parameters

    • object: T

      The object to invert.

    • Optional multiValue: boolean

      Allow multiple values per key.

    Returns TResult

    Returns the new inverted object.

  • see

    _.invert

    Type parameters

    • TResult: __type

    Parameters

    • object: Object
    • Optional multiValue: boolean

    Returns TResult

invokeMap

  • invokeMap<TValue, TResult>(collection: TValue[], methodName: string, ...args: any[]): TResult[]
  • invokeMap<TValue, TResult>(collection: Dictionary<TValue>, methodName: string, ...args: any[]): TResult[]
  • invokeMap<TResult>(collection: __type[], methodName: string, ...args: any[]): TResult[]
  • invokeMap<TResult>(collection: Dictionary<__type>, methodName: string, ...args: any[]): TResult[]
  • invokeMap<TValue, TResult>(collection: TValue[], method: function, ...args: any[]): TResult[]
  • invokeMap<TValue, TResult>(collection: Dictionary<TValue>, method: function, ...args: any[]): TResult[]
  • invokeMap<TResult>(collection: __type[], method: function, ...args: any[]): TResult[]
  • invokeMap<TResult>(collection: Dictionary<__type>, method: function, ...args: any[]): TResult[]
  • Invokes the method named by methodName on each element in the collection returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If methodName is a function it will be invoked for, and this bound to, each element in the collection.

    Type parameters

    • TValue: __type

    • TResult

    Parameters

    • collection: TValue[]

      The collection to iterate over.

    • methodName: string

      The name of the method to invoke.

    • Rest ...args: any[]

      Arguments to invoke the method with.

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TValue: __type

    • TResult

    Parameters

    • collection: Dictionary<TValue>
    • methodName: string
    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TResult

    Parameters

    • collection: __type[]
    • methodName: string
    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TResult

    Parameters

    • collection: Dictionary<__type>
    • methodName: string
    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TValue: __type

    • TResult

    Parameters

    • collection: TValue[]
    • method: function
        • (...args: any[]): TResult
        • Parameters

          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TValue: __type

    • TResult

    Parameters

    • collection: Dictionary<TValue>
    • method: function
        • (...args: any[]): TResult
        • Parameters

          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TResult

    Parameters

    • collection: __type[]
    • method: function
        • (...args: any[]): TResult
        • Parameters

          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult[]

  • see

    _.invokeMap

    Type parameters

    • TResult

    Parameters

    • collection: Dictionary<__type>
    • method: function
        • (...args: any[]): TResult
        • Parameters

          • Rest ...args: any[]

          Returns TResult

    • Rest ...args: any[]

    Returns TResult[]

isArguments

  • isArguments(value?: any): boolean
  • Checks if value is classified as an arguments object.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isArray

  • isArray<T>(value?: any): boolean
  • Checks if value is classified as an Array object.

    Type parameters

    • T

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isArrayLike

  • isArrayLike<T>(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.

    static
    memberof

    _

    type

    Function

    category

    Lang

    example

    _.isArrayLike([1, 2, 3]); // => true

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

    _.isArrayLike('abc'); // => true

    .isArrayLike(.noop); // => false

    Type parameters

    • T

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

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

isArrayLikeObject

  • isArrayLikeObject<T>(value?: any): boolean
  • This method is like _.isArrayLike except that it also checks if value is an object.

    static
    memberof

    _

    type

    Function

    category

    Lang

    example

    _.isArrayLikeObject([1, 2, 3]); // => true

    _.isArrayLikeObject(document.body.children); // => true

    _.isArrayLikeObject('abc'); // => false

    .isArrayLikeObject(.noop); // => false

    Type parameters

    • T

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

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

isBoolean

  • isBoolean(value?: any): boolean
  • Checks if value is classified as a boolean primitive or object.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isDate

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

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isElement

  • isElement(value?: any): boolean
  • Checks if value is a DOM element.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is a DOM element, else false.

isEmpty

  • isEmpty(value?: any): boolean
  • Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or jQuery-like collection with a length greater than 0 or an object with own enumerable properties.

    Parameters

    • Optional value: any

      The value to inspect.

    Returns boolean

    Returns true if value is empty, else false.

isEqual

  • isEqual(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 not supported.

    static
    memberof

    _

    category

    Lang

    example

    var object = { 'user': 'fred' }; var other = { 'user': 'fred' };

    _.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

  • 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 seven arguments: (objValue, othValue [, index|key, object, other, stack]).

    static
    memberof

    _

    category

    Lang

    example

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

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

    var array = ['hello', 'goodbye']; var other = ['hi', 'goodbye'];

    _.isEqualWith(array, other, customizer); // => true

    Parameters

    • value: any

      The value to compare.

    • other: any

      The other value to compare.

    • customizer: IsEqualCustomizer

    Returns boolean

    Returns true if the values are equivalent, else false.

isError

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

    Parameters

    • value: any

      The value to check.

    Returns boolean

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

isFinite

  • isFinite(value?: any): boolean
  • Checks if value is a finite primitive number.

    Note: This method is based on Number.isFinite.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is a finite number, else false.

isFunction

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

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isInteger

  • isInteger(value?: any): boolean
  • Checks if value is an integer.

    Note: This method is based on Number.isInteger.

    static
    memberof

    _

    category

    Lang

    example

    _.isInteger(3); // => true

    .isInteger(Number.MINVALUE); // => false

    _.isInteger(Infinity); // => false

    _.isInteger('3'); // => false

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is an integer, else false.

isLength

  • isLength(value?: any): boolean
  • Checks if value is a valid array-like length.

    Note: This function is loosely based on ToLength.

    static
    memberof

    _

    category

    Lang

    example

    _.isLength(3); // => true

    .isLength(Number.MINVALUE); // => false

    _.isLength(Infinity); // => false

    _.isLength('3'); // => false

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is a valid length, else false.

isMatch

  • isMatch(object: Object, source: Object): boolean
  • Performs a deep comparison between object and source to determine if object contains equivalent property values.

    Note: This method supports comparing the same values as _.isEqual.

    static
    memberof

    _

    category

    Lang

    example

    var object = { 'user': 'fred', 'age': 40 };

    _.isMatch(object, { 'age': 40 }); // => true

    _.isMatch(object, { 'age': 36 }); // => false

    Parameters

    • object: Object

      The object to inspect.

    • source: Object

      The object of property values to match.

    Returns boolean

    Returns true if object is a match, else false.

isMatchWith

  • This method is like _.isMatch 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 three arguments: (objValue, srcValue, index|key, object, source).

    static
    memberof

    _

    category

    Lang

    example

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

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

    var object = { 'greeting': 'hello' }; var source = { 'greeting': 'hi' };

    _.isMatchWith(object, source, customizer); // => true

    Parameters

    • object: Object

      The object to inspect.

    • source: Object

      The object of property values to match.

    • customizer: isMatchWithCustomizer

    Returns boolean

    Returns true if object is a match, else false.

isNaN

  • isNaN(value?: any): boolean
  • Checks if value is NaN.

    Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is NaN, else false.

isNative

  • isNative(value: any): boolean
  • Checks if value is a native function.

    retrun

    Returns true if value is a native function, else false.

    Parameters

    • value: any

      The value to check.

    Returns boolean

isNil

  • isNil(value?: any): boolean
  • Checks if value is null or undefined.

    static
    memberof

    _

    category

    Lang

    example

    _.isNil(null); // => true

    _.isNil(void 0); // => true

    _.isNil(NaN); // => false

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is nullish, else false.

isNull

  • isNull(value?: any): boolean
  • Checks if value is null.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is null, else false.

isNumber

  • isNumber(value?: any): boolean
  • 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 _.isFinite method.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isObject

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

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is an object, else false.

isObjectLike

  • isObjectLike(value?: any): boolean
  • Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".

    static
    memberof

    _

    category

    Lang

    example

    _.isObjectLike({}); // => true

    _.isObjectLike([1, 2, 3]); // => true

    .isObjectLike(.noop); // => false

    _.isObjectLike(null); // => false

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

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

isPlainObject

  • isPlainObject(value?: any): boolean
  • Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

    Note: This method assumes objects created by the Object constructor have no inherited enumerable properties.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

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

isRegExp

  • isRegExp(value?: any): boolean
  • Checks if value is classified as a RegExp object.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isSafeInteger

  • isSafeInteger(value: any): boolean
  • Checks if value is a safe integer. An integer is safe if it's an IEEE-754 double precision number which isn't the result of a rounded unsafe integer.

    Note: This method is based on Number.isSafeInteger.

    static
    memberof

    _

    category

    Lang

    example

    _.isSafeInteger(3); // => true

    .isSafeInteger(Number.MINVALUE); // => false

    _.isSafeInteger(Infinity); // => false

    _.isSafeInteger('3'); // => false

    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is a safe integer, else false.

isString

  • isString(value?: any): boolean
  • Checks if value is classified as a String primitive or object.

    Parameters

    • Optional value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isSymbol

  • isSymbol(value: any): boolean
  • Checks if value is classified as a Symbol primitive or object.

    static
    memberof

    _

    category

    Lang

    example

    _.isSymbol(Symbol.iterator); // => true

    _.isSymbol('abc'); // => false

    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isTypedArray

  • isTypedArray(value: any): boolean
  • Checks if value is classified as a typed array.

    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is correctly classified, else false.

isUndefined

  • isUndefined(value: any): boolean
  • Checks if value is undefined.

    Parameters

    • value: any

      The value to check.

    Returns boolean

    Returns true if value is undefined, else false.

iteratee

  • iteratee<TResult>(func: Function, thisArg?: any): function
  • iteratee<TResult>(func: string, thisArg?: any): function
  • iteratee(func: Object, thisArg?: any): function
  • iteratee<TResult>(): function
  • Creates a function that invokes func with the arguments of the created function. If func is a property name the created callback returns the property value for a given element. If func is an object the created callback returns true for elements that contain the equivalent object properties, otherwise it returns false.

    static
    memberof

    _

    category

    Util

    example

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

    // create custom iteratee shorthands .iteratee = _.wrap(.iteratee, function(callback, func) { var p = /^(\S+)\s([<>])\s(\S+)$/.exec(func); return !p ? callback(func) : function(object) { return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); }; });

    _.filter(users, 'age > 36'); // => [{ 'user': 'fred', 'age': 40 }]

    Type parameters

    • TResult

    Parameters

    • func: Function
    • Optional thisArg: any

    Returns function

    Returns the callback.

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

        • Rest ...args: any[]

        Returns TResult

  • see

    _.iteratee

    Type parameters

    • TResult

    Parameters

    • func: string
    • Optional thisArg: any

    Returns function

      • (object: any): TResult
      • Parameters

        • object: any

        Returns TResult

  • see

    _.iteratee

    Parameters

    • func: Object
    • Optional thisArg: any

    Returns function

      • (object: any): boolean
      • Parameters

        • object: any

        Returns boolean

  • see

    _.iteratee

    Type parameters

    • TResult

    Returns function

      • (value: TResult): TResult
      • Parameters

        • value: TResult

        Returns TResult

join

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

    Parameters

    • array: List<any>

      The array to convert.

    • Optional separator: string

      The element separator.

    Returns string

    Returns the joined string.

kebabCase

  • kebabCase(string?: string): string
  • Converts string to kebab case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the kebab cased string.

keyBy

  • Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is the last element responsible for generating the key. The iteratee function is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for iteratee the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, any>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns the composed aggregate object.

  • see

    _.keyBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.keyBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.keyBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.keyBy

    Type parameters

    • W: Object

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.keyBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

keys

  • keys(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.

    Parameters

    • Optional object: any

      The object to query.

    Returns string[]

    Returns the array of property names.

keysIn

  • keysIn(object?: any): string[]
  • Creates an array of the own and inherited enumerable property names of object.

    Note: Non-object values are coerced to objects.

    Parameters

    • Optional object: any

      The object to query.

    Returns string[]

    An array of property names.

last

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    Returns T

    Returns the last element of array.

lastIndexOf

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to search.

    • value: T

      The value to search for.

    • Optional fromIndex: boolean | number

      The index to search from or true to perform a binary search on a sorted array.

    Returns number

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

lowerCase

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

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the lower cased string.

lowerFirst

  • lowerFirst(string?: string): string
  • Converts the first character of string to lower case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the converted string.

lt

  • lt(value: any, other: any): boolean
  • Checks if value is less than other.

    Parameters

    • value: any

      The value to compare.

    • other: any

      The other value to compare.

    Returns boolean

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

lte

  • lte(value: any, other: any): boolean
  • Checks if value is less than or equal to other.

    Parameters

    • value: any

      The value to compare.

    • other: any

      The other value to compare.

    Returns boolean

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

map

  • map<T, TResult>(collection: List<T>, iteratee?: ListIterator<T, TResult>, thisArg?: any): TResult[]
  • map<T, TResult>(collection: Dictionary<T>, iteratee?: DictionaryIterator<T, TResult>, thisArg?: any): TResult[]
  • map<T, TResult>(collection: List<T> | Dictionary<T>, iteratee?: string): TResult[]
  • map<T, TObject>(collection: List<T> | Dictionary<T>, iteratee?: TObject): boolean[]
  • Creates an array of values by running each element in collection through iteratee. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for iteratee the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false.

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

    The guarded methods are: ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, sample, some, sum, uniq, and words

    Type parameters

    • T

    • TResult

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, TResult>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns TResult[]

    Returns the new mapped array.

  • see

    _.map

    Type parameters

    • T: __type

    • TResult

    Parameters

    Returns TResult[]

  • see

    _.map

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult[]

  • see

    _.map

    Type parameters

    • T

    • TObject: __type

    Parameters

    Returns boolean[]

mapKeys

  • The opposite of _.mapValues; this method creates an object with the same values as object and keys generated by running each own enumerable property of object through iteratee.

    Type parameters

    • T

    • TKey

    Parameters

    • object: List<T>

      The object to iterate over.

    • Optional iteratee: ListIterator<T, TKey>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns Dictionary<T>

    Returns the new mapped object.

  • see

    _.mapKeys

    Type parameters

    • T

    • TKey

    Parameters

    Returns Dictionary<T>

  • see

    _.mapKeys

    Type parameters

    • T

    • TObject: __type

    Parameters

    Returns Dictionary<T>

  • see

    _.mapKeys

    Type parameters

    • T

    Parameters

    • object: List<T> | Dictionary<T>
    • Optional iteratee: string
    • Optional thisArg: any

    Returns Dictionary<T>

mapValues

  • Creates an object with the same keys as object and values generated by running each own enumerable property of object through iteratee. The iteratee function is bound to thisArg and invoked with three arguments: (value, key, object).

    If a property name is provided iteratee the created "_.property" style callback returns the property value of the given element.

    If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns true for elements that have a matching property value, else false;.

    If an object is provided for iteratee the created "_.matches" style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    • TResult

    Parameters

    Returns Dictionary<TResult>

    Returns the new mapped object.

  • Type parameters

    • T

    Parameters

    Returns Dictionary<boolean>

  • Type parameters

    • T

    • TMapped

    Parameters

    • obj: T
    • pluck: string

    Returns TMapped

  • Type parameters

    • T

    Parameters

    Returns T

matches

  • matches<T>(source: T): function
  • matches<T, V>(source: T): function
  • Creates a function that performs a deep comparison between a given object and source, returning true if the given object has equivalent property values, else false.

    Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own or inherited property value see _.matchesProperty.

    Type parameters

    • T

    Parameters

    • source: T

      The object of property values to match.

    Returns function

    Returns the new function.

      • (value: any): boolean
      • Parameters

        • value: any

        Returns boolean

  • see

    _.matches

    Type parameters

    • T

    • V

    Parameters

    • source: T

    Returns function

      • (value: V): boolean
      • Parameters

        • value: V

        Returns boolean

matchesProperty

  • Creates a function that compares the property value of path on a given object to value.

    Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and strings. Objects are compared by their own, not inherited, enumerable properties.

    Type parameters

    • T

    Parameters

    Returns function

    Returns the new function.

      • (value: any): boolean
      • Parameters

        • value: any

        Returns boolean

  • see

    _.matchesProperty

    Type parameters

    • T

    • V

    Parameters

    Returns function

      • (value: V): boolean
      • Parameters

        • value: V

        Returns boolean

max

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

    static
    memberof

    _

    category

    Math

    Type parameters

    • T

    Parameters

    • collection: List<T>

    Returns T

    Returns the maximum value.

maxBy

  • 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).

    static
    memberof

    _

    category

    Math

    example

    var objects = [{ 'n': 1 }, { 'n': 2 }];

    _.maxBy(objects, function(o) { return o.a; }); // => { 'n': 2 }

    // using the _.property iteratee shorthand _.maxBy(objects, 'n'); // => { 'n': 2 }

    Type parameters

    • T

    Parameters

    Returns T

    Returns the maximum value.

  • see

    _.maxBy

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.maxBy

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.maxBy

    Type parameters

    • TObject: __type

    • T

    Parameters

    Returns T

mean

  • mean<T>(collection: List<T>): number
  • Computes the mean of the values in array.

    static
    memberof

    _

    category

    Math

    example

    _.mean([4, 2, 8, 6]); // => 5

    Type parameters

    • T

    Parameters

    • collection: List<T>

    Returns number

    Returns the mean.

merge

  • merge<TObject, TSource>(object: TObject, source: TSource): TObject & TSource
  • merge<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2
  • merge<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3
  • merge<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TObject & TSource1 & TSource2 & TSource3 & TSource4
  • merge<TResult>(object: any, ...otherArgs: any[]): TResult
  • Recursively merges own and inherited enumerable properties of source objects into the destination object, skipping source properties that resolve to undefined. 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.

    static
    memberof

    _

    category

    Object

    example

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

    var ages = { 'data': [{ 'age': 36 }, { 'age': 40 }] };

    _.merge(users, ages); // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }

    Type parameters

    • TObject

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TObject & TSource

    Returns object.

  • see

    _.merge

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2

    Returns TObject & TSource1 & TSource2

  • see

    _.merge

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    _.merge

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

  • see

    _.merge

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

mergeWith

  • mergeWith<TObject, TSource>(object: TObject, source: TSource, customizer: MergeWithCustomizer): TObject & TSource
  • mergeWith<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2
  • mergeWith<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3
  • mergeWith<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3 & TSource4
  • mergeWith<TResult>(object: any, ...otherArgs: any[]): TResult
  • 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 seven arguments: (objValue, srcValue, key, object, source, stack).

    static
    memberof

    _

    category

    Object

    example

    function customizer(objValue, srcValue) { if (_.isArray(objValue)) { return objValue.concat(srcValue); } }

    var object = { 'fruits': ['apple'], 'vegetables': ['beet'] };

    var other = { 'fruits': ['banana'], 'vegetables': ['carrot'] };

    _.merge(object, other, customizer); // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }

    Type parameters

    • TObject

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • customizer: MergeWithCustomizer

      The function to customize assigned values.

    Returns TObject & TSource

    Returns object.

  • see

    _.mergeWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

    Returns TObject & TSource1 & TSource2

  • see

    _.mergeWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • customizer: MergeWithCustomizer

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    _.mergeWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

    • object: TObject
    • source1: TSource1
    • source2: TSource2
    • source3: TSource3
    • source4: TSource4
    • customizer: MergeWithCustomizer

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

  • see

    _.mergeWith

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

method

  • Creates a function that invokes the method at path on a given object. Any additional arguments are provided to the invoked method.

    Type parameters

    • TObject

    • TResult

    Parameters

    • path: string | StringRepresentable[]

      The path of the method to invoke.

    • Rest ...args: any[]

      The arguments to invoke the method with.

    Returns function

    Returns the new function.

      • (object: TObject): TResult
      • Parameters

        • object: TObject

        Returns TResult

  • see

    _.method

    Type parameters

    • TResult

    Parameters

    Returns function

      • (object: any): TResult
      • Parameters

        • object: any

        Returns TResult

methodOf

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

    Type parameters

    • TObject: __type

    • TResult

    Parameters

    • object: TObject

      The object to query.

    • Rest ...args: any[]

      The arguments to invoke the method with.

    Returns function

    Returns the new function.

  • see

    _.methodOf

    Type parameters

    • TResult

    Parameters

    • object: __type
    • Rest ...args: any[]

    Returns function

min

  • min<T>(collection: List<T>): T
  • Computes the minimum value of array. If array is empty or falsey undefined is returned.

    static
    memberof

    _

    category

    Math

    Type parameters

    • T

    Parameters

    • collection: List<T>

    Returns T

    Returns the minimum value.

minBy

  • 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).

    static
    memberof

    _

    category

    Math

    example

    var objects = [{ 'n': 1 }, { 'n': 2 }];

    _.minBy(objects, function(o) { return o.a; }); // => { 'n': 1 }

    // using the _.property iteratee shorthand _.minBy(objects, 'n'); // => { 'n': 1 }

    Type parameters

    • T

    Parameters

    Returns T

    Returns the minimum value.

  • see

    _.minBy

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.minBy

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.minBy

    Type parameters

    • TObject: __type

    • T

    Parameters

    Returns T

mixin

  • Adds all own enumerable function properties of a source object to the destination object. If object is a function then methods are added to its prototype as well.

    Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying the original.

    Type parameters

    • TResult

    • TObject

    Parameters

    • object: TObject

      The destination object.

    • source: Dictionary<Function>

      The object of functions to add.

    • Optional options: MixinOptions

      The options object.

    Returns TResult

    Returns object.

  • see

    _.mixin

    Type parameters

    • TResult

    Parameters

    Returns TResult

negate

  • negate<T>(predicate: T): function
  • negate<T, TResult>(predicate: T): TResult
  • Creates a function that negates the result of the predicate func. The func predicate is invoked with the this binding and arguments of the created function.

    Type parameters

    • T: Function

    Parameters

    • predicate: T

      The predicate to negate.

    Returns function

    Returns the new function.

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

        • Rest ...args: any[]

        Returns boolean

  • see

    _.negate

    Type parameters

    • T: Function

    • TResult: Function

    Parameters

    • predicate: T

    Returns TResult

noConflict

  • Reverts the _ variable to its previous value and returns a reference to the lodash function.

    Returns LoDashStatic

    Returns the lodash function.

noop

  • noop(...args: any[]): void
  • A no-operation function that returns undefined regardless of the arguments it receives.

    Parameters

    • Rest ...args: any[]

    Returns void

    undefined

now

  • now(): number
  • Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

    Returns number

    The number of milliseconds.

nthArg

  • nthArg<TResult>(n?: number): TResult
  • Creates a function that returns its nth argument.

    Type parameters

    • TResult: Function

    Parameters

    • Optional n: number

      The index of the argument to return.

    Returns TResult

    Returns the new function.

omit

  • The opposite of _.pick; this method creates an object composed of the own and inherited enumerable properties of object that are not omitted.

    static
    memberof

    _

    category

    Object

    example

    var object = { 'a': 1, 'b': '2', 'c': 3 };

    _.omit(object, ['a', 'c']); // => { 'b': '2' }

    Type parameters

    • TResult: __type

    • T: __type

    Parameters

    Returns TResult

    Returns the new object.

omitBy

  • omitBy<TResult, T>(object: T, predicate: ObjectIterator<any, boolean>): TResult
  • The opposite of _.pickBy; this method creates an object composed of the own and inherited enumerable properties of object that predicate doesn't return truthy for.

    static
    memberof

    _

    category

    Object

    example

    var object = { 'a': 1, 'b': '2', 'c': 3 };

    _.omitBy(object, _.isNumber); // => { 'b': '2' }

    Type parameters

    • TResult: __type

    • T: __type

    Parameters

    • object: T

      The source object.

    • predicate: ObjectIterator<any, boolean>

    Returns TResult

    Returns the new object.

once

  • once<T>(func: T): T
  • Creates a function that is restricted to invoking func once. Repeat calls to the function return the value of the first call. The func is invoked with the this binding and arguments of the created function.

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to restrict.

    Returns T

    Returns the new restricted function.

orderBy

  • This method is like _.sortBy except that it allows specifying the sort orders of the iteratees to sort by. If orders is unspecified, all values are sorted in ascending order. Otherwise, specify an order of "desc" for descending or "asc" for ascending sort order of corresponding values.

    static
    memberof

    _

    category

    Collection

    param-

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

    example

    var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age': 34 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 36 } ];

    // sort by user in ascending order and by age in descending order _.orderBy(users, ['user', 'age'], ['asc', 'desc']); // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]

    Type parameters

    • W: Object

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • iteratees: ListIterator<T, any> | string | W | (string | ListIterator<T, any> | W)[]
    • Optional orders: boolean | string | (string | false | true)[]

    Returns T[]

    Returns the new sorted array.

  • see

    _.orderBy

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • iteratees: ListIterator<T, any> | string | Object | (string | Object | ListIterator<T, any>)[]
    • Optional orders: boolean | string | (string | false | true)[]

    Returns T[]

  • see

    _.orderBy

    Type parameters

    • W: Object

    • T

    Parameters

    Returns T[]

  • see

    _.orderBy

    Type parameters

    • T

    Parameters

    Returns T[]

  • see

    _.orderBy

    Type parameters

    • W: Object

    • T

    Parameters

    Returns T[]

  • see

    _.orderBy

    Type parameters

    • T

    Parameters

    Returns T[]

over

  • over<TResult>(...iteratees: (Function | Function[])[]): function
  • Creates a function that invokes iteratees with the arguments provided to the created function and returns their results.

    Type parameters

    • TResult

    Parameters

    • Rest ...iteratees: (Function | Function[])[]

      The iteratees to invoke.

    Returns function

    Returns the new function.

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

        • Rest ...args: any[]

        Returns TResult[]

overArgs

  • overArgs<T, TResult>(func: T, ...transforms: Function[]): TResult
  • overArgs<T, TResult>(func: T, transforms: Function[]): TResult
  • Creates a function that runs each argument through a corresponding transform function.

    Type parameters

    • T: Function

    • TResult: Function

    Parameters

    • func: T

      The function to wrap.

    • Rest ...transforms: Function[]

      The functions to transform arguments, specified as individual functions or arrays of functions.

    Returns TResult

    Returns the new function.

  • see

    _.overArgs

    Type parameters

    • T: Function

    • TResult: Function

    Parameters

    • func: T
    • transforms: Function[]

    Returns TResult

overEvery

  • overEvery(...predicates: (Function | Function[])[]): function
  • Creates a function that checks if all of the predicates return truthy when invoked with the arguments provided to the created function.

    Parameters

    • Rest ...predicates: (Function | Function[])[]

      The predicates to check.

    Returns function

    Returns the new function.

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

        • Rest ...args: any[]

        Returns boolean

overSome

  • overSome(...predicates: (Function | Function[])[]): function
  • Creates a function that checks if any of the predicates return truthy when invoked with the arguments provided to the created function.

    Parameters

    • Rest ...predicates: (Function | Function[])[]

      The predicates to check.

    Returns function

    Returns the new function.

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

        • Rest ...args: any[]

        Returns boolean

pad

  • pad(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.

    Parameters

    • Optional string: string

      The string to pad.

    • Optional length: number

      The padding length.

    • Optional chars: string

      The string used as padding.

    Returns string

    Returns the padded string.

padEnd

  • padEnd(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.

    Parameters

    • Optional string: string

      The string to pad.

    • Optional length: number

      The padding length.

    • Optional chars: string

      The string used as padding.

    Returns string

    Returns the padded string.

padStart

  • padStart(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.

    Parameters

    • Optional string: string

      The string to pad.

    • Optional length: number

      The padding length.

    • Optional chars: string

      The string used as padding.

    Returns string

    Returns the padded string.

parseInt

  • parseInt(string: string, radix?: number): number
  • Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used unless value is a hexadecimal, in which case a radix of 16 is used.

    Note: This method aligns with the ES5 implementation of parseInt.

    Parameters

    • string: string

      The string to convert.

    • Optional radix: number

      The radix to interpret value by.

    Returns number

    Returns the converted integer.

partition

  • partition<T>(collection: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[][]
  • partition<T>(collection: Dictionary<T>, callback: DictionaryIterator<T, boolean>, thisArg?: any): T[][]
  • partition<W, T>(collection: List<T>, whereValue: W): T[][]
  • partition<W, T>(collection: Dictionary<T>, whereValue: W): T[][]
  • partition<T>(collection: List<T>, path: string, srcValue: any): T[][]
  • partition<T>(collection: Dictionary<T>, path: string, srcValue: any): T[][]
  • partition<T>(collection: List<T>, pluckValue: string): T[][]
  • partition<T>(collection: Dictionary<T>, pluckValue: string): T[][]
  • Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, while the second of which contains elements predicate returns falsey for. The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • callback: ListIterator<T, boolean>

      The function called per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns T[][]

    Returns the array of grouped elements.

  • see

    _.partition

    Type parameters

    • T

    Parameters

    Returns T[][]

  • see

    _.partition

    Type parameters

    • W

    • T

    Parameters

    • collection: List<T>
    • whereValue: W

    Returns T[][]

  • see

    _.partition

    Type parameters

    • W

    • T

    Parameters

    Returns T[][]

  • see

    _.partition

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • path: string
    • srcValue: any

    Returns T[][]

  • see

    _.partition

    Type parameters

    • T

    Parameters

    • collection: Dictionary<T>
    • path: string
    • srcValue: any

    Returns T[][]

  • see

    _.partition

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • pluckValue: string

    Returns T[][]

  • see

    _.partition

    Type parameters

    • T

    Parameters

    Returns T[][]

pick

  • Creates an object composed of the picked object properties.

    static
    memberof

    _

    category

    Object

    example

    var object = { 'a': 1, 'b': '2', 'c': 3 };

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

    Type parameters

    • TResult: __type

    • T: __type

    Parameters

    Returns TResult

    Returns the new object.

pickBy

  • pickBy<TResult, T>(object: T, predicate: ObjectIterator<any, boolean>): TResult
  • Creates an object composed of the object properties predicate returns truthy for. The predicate is invoked with one argument: (value).

    static
    memberof

    _

    category

    Object

    example

    var object = { 'a': 1, 'b': '2', 'c': 3 };

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

    Type parameters

    • TResult: __type

    • T: __type

    Parameters

    • object: T

      The source object.

    • predicate: ObjectIterator<any, boolean>

    Returns TResult

    Returns the new object.

property

  • Creates a function that returns the property value at path on a given object.

    Type parameters

    • TObj

    • TResult

    Parameters

    Returns function

    Returns the new function.

      • (obj: TObj): TResult
      • Parameters

        • obj: TObj

        Returns TResult

propertyOf

  • propertyOf<T>(object: T): function
  • The opposite of _.property; this method creates a function that returns the property value at a given path on object.

    Type parameters

    • T: __type

    Parameters

    • object: T

      The object to query.

    Returns function

    Returns the new function.

      • (path: string | string[]): any
      • Parameters

        • path: string | string[]

        Returns any

pull

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

    Note: Unlike _.without, this method mutates array.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to modify.

    • Rest ...values: T[]

      The values to remove.

    Returns T[]

    Returns array.

  • see

    _.pull

    Type parameters

    • T

    Parameters

    • array: List<T>
    • Rest ...values: T[]

    Returns List<T>

pullAll

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

    Note: Unlike _.difference, this method mutates array.

    static
    memberof

    _

    category

    Array

    example

    var array = [1, 2, 3, 1, 2, 3];

    _.pull(array, [2, 3]); console.log(array); // => [1, 1]

    Parameters

    • array: any[] | List<any>

      The array to modify.

    • Rest ...values: any[]

      The values to remove.

    Returns any[]

    Returns array.

pullAllBy

  • pullAllBy(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.pullAll except that it accepts iteratee which is invoked for each element of array and values to to generate the criterion by which uniqueness is computed. The iteratee is invoked with one argument: (value).

    Note: Unlike _.differenceBy, this method mutates array.

    static
    memberof

    _

    category

    Array

    example

    var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];

    _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); console.log(array); // => [{ 'x': 2 }]

    Parameters

    • array: any[] | List<any>

      The array to modify.

    • Rest ...values: any[]

      The values to remove.

    Returns any[]

    Returns array.

pullAt

  • pullAt<T>(array: List<T>, ...indexes: (number | number[])[]): T[]
  • Removes elements from array corresponding to the given indexes and returns an array of the removed elements. Indexes may be specified as an array of indexes or as individual arguments.

    Note: Unlike _.at, this method mutates array.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to modify.

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

      The indexes of elements to remove, specified as individual indexes or arrays of indexes.

    Returns T[]

    Returns the new array of removed elements.

random

  • random(min?: number, max?: number, floating?: boolean): number
  • random(min?: number, floating?: boolean): number
  • random(floating?: boolean): number
  • Produces a random number between min and max (inclusive). If only one argument is provided a number between 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point number is returned instead of an integer.

    Parameters

    • Optional min: number

      The minimum possible value.

    • Optional max: number

      The maximum possible value.

    • Optional floating: boolean

      Specify returning a floating-point number.

    Returns number

    Returns the random number.

  • see

    _.random

    Parameters

    • Optional min: number
    • Optional floating: boolean

    Returns number

  • see

    _.random

    Parameters

    • Optional floating: boolean

    Returns number

range

  • range(start: number, end: number, step?: number): number[]
  • range(end: number, step?: number): number[]
  • Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length range is created unless a negative step is specified.

    Parameters

    • start: number

      The start of the range.

    • end: number

      The end of the range.

    • Optional step: number

      The value to increment or decrement by.

    Returns number[]

    Returns a new range array.

  • see

    _.range

    Parameters

    • end: number
    • Optional step: number

    Returns number[]

rangeRight

  • rangeRight(start: number, end: number, step?: number): number[]
  • rangeRight(end: number, step?: number): number[]
  • This method is like _.range except that it populates values in descending order.

    static
    memberof

    _

    category

    Util

    example

    _.rangeRight(4); // => [3, 2, 1, 0]

    _.rangeRight(-4); // => [-3, -2, -1, 0]

    _.rangeRight(1, 5); // => [4, 3, 2, 1]

    _.rangeRight(0, 20, 5); // => [15, 10, 5, 0]

    _.rangeRight(0, -4, -1); // => [-3, -2, -1, 0]

    _.rangeRight(1, 4, 0); // => [1, 1, 1]

    _.rangeRight(0); // => []

    Parameters

    • start: number
    • end: number

      The end of the range.

    • Optional step: number

    Returns number[]

    Returns the new array of numbers.

  • see

    _.rangeRight

    Parameters

    • end: number
    • Optional step: number

    Returns number[]

rearg

  • rearg<TResult>(func: Function, indexes: number[]): TResult
  • rearg<TResult>(func: Function, ...indexes: number[]): TResult
  • Creates a function that invokes func with arguments arranged according to the specified indexes where the argument value at the first index is provided as the first argument, the argument value at the second index is provided as the second argument, and so on.

    Type parameters

    • TResult: Function

    Parameters

    • func: Function

      The function to rearrange arguments for.

    • indexes: number[]

      The arranged argument indexes, specified as individual indexes or arrays of indexes.

    Returns TResult

    Returns the new function.

  • see

    _.rearg

    Type parameters

    • TResult: Function

    Parameters

    • func: Function
    • Rest ...indexes: number[]

    Returns TResult

reduce

  • reduce<T, TResult>(collection: Array<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduce<T, TResult>(collection: List<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduce<T, TResult>(collection: Dictionary<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduce<T, TResult>(collection: Array<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • reduce<T, TResult>(collection: List<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • reduce<T, TResult>(collection: Dictionary<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If accumulator is not provided the first element of the collection will be used as the initial accumulator value. The callback is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection).

    Type parameters

    • T

    • TResult

    Parameters

    • collection: Array<T>

      The collection to iterate over.

    • callback: MemoIterator<T, TResult>

      The function called per iteration.

    • accumulator: TResult

      Initial value of the accumulator.

    • Optional thisArg: any

      The this binding of callback.

    Returns TResult

    Returns the accumulated value.

  • see

    _.reduce

    Type parameters

    • T

    • TResult

    Parameters

    • collection: List<T>
    • callback: MemoIterator<T, TResult>
    • accumulator: TResult
    • Optional thisArg: any

    Returns TResult

  • see

    _.reduce

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

  • see

    _.reduce

    Type parameters

    • T

    • TResult

    Parameters

    • collection: Array<T>
    • callback: MemoIterator<T, TResult>
    • Optional thisArg: any

    Returns TResult

  • see

    _.reduce

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

  • see

    _.reduce

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

reduceRight

  • reduceRight<T, TResult>(collection: Array<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduceRight<T, TResult>(collection: List<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduceRight<T, TResult>(collection: Dictionary<T>, callback: MemoIterator<T, TResult>, accumulator: TResult, thisArg?: any): TResult
  • reduceRight<T, TResult>(collection: Array<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • reduceRight<T, TResult>(collection: List<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • reduceRight<T, TResult>(collection: Dictionary<T>, callback: MemoIterator<T, TResult>, thisArg?: any): TResult
  • This method is like _.reduce except that it iterates over elements of a collection from right to left.

    Type parameters

    • T

    • TResult

    Parameters

    • collection: Array<T>

      The collection to iterate over.

    • callback: MemoIterator<T, TResult>

      The function called per iteration.

    • accumulator: TResult

      Initial value of the accumulator.

    • Optional thisArg: any

      The this binding of callback.

    Returns TResult

    The accumulated value.

  • see

    _.reduceRight

    Type parameters

    • T

    • TResult

    Parameters

    • collection: List<T>
    • callback: MemoIterator<T, TResult>
    • accumulator: TResult
    • Optional thisArg: any

    Returns TResult

  • see

    _.reduceRight

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

  • see

    _.reduceRight

    Type parameters

    • T

    • TResult

    Parameters

    • collection: Array<T>
    • callback: MemoIterator<T, TResult>
    • Optional thisArg: any

    Returns TResult

  • see

    _.reduceRight

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

  • see

    _.reduceRight

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult

reject

  • reject<T>(collection: List<T>, predicate?: ListIterator<T, boolean>, thisArg?: any): T[]
  • reject<T>(collection: Dictionary<T>, predicate?: DictionaryIterator<T, boolean>, thisArg?: any): T[]
  • reject(collection: string, predicate?: StringIterator<boolean>, thisArg?: any): string[]
  • reject<T>(collection: List<T> | Dictionary<T>, predicate: string, thisArg?: any): T[]
  • reject<W, T>(collection: List<T> | Dictionary<T>, predicate: W): T[]
  • The opposite of _.filter; this method returns the elements of collection that predicate does not return truthy for.

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns T[]

    Returns the new filtered array.

  • see

    _.reject

    Type parameters

    • T

    Parameters

    Returns T[]

  • see

    _.reject

    Parameters

    • collection: string
    • Optional predicate: StringIterator<boolean>
    • Optional thisArg: any

    Returns string[]

  • see

    _.reject

    Type parameters

    • T

    Parameters

    • collection: List<T> | Dictionary<T>
    • predicate: string
    • Optional thisArg: any

    Returns T[]

  • see

    _.reject

    Type parameters

    • W: __type

    • T

    Parameters

    Returns T[]

remove

  • remove<T>(array: List<T>, predicate?: ListIterator<T, boolean>, thisArg?: any): T[]
  • remove<T>(array: List<T>, predicate?: string, thisArg?: any): T[]
  • remove<W, T>(array: List<T>, predicate?: W): T[]
  • Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Note: Unlike _.filter, this method mutates array.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to modify.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns T[]

    Returns the new array of removed elements.

  • see

    _.remove

    Type parameters

    • T

    Parameters

    • array: List<T>
    • Optional predicate: string
    • Optional thisArg: any

    Returns T[]

  • see

    _.remove

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • Optional predicate: W

    Returns T[]

repeat

  • repeat(string?: string, n?: number): string
  • Repeats the given string n times.

    Parameters

    • Optional string: string

      The string to repeat.

    • Optional n: number

      The number of times to repeat the string.

    Returns string

    Returns the repeated string.

replace

  • replace(string: string, pattern: RegExp | string, replacement: Function | string): string
  • replace(pattern?: RegExp | string, replacement?: Function | string): string
  • Replaces matches for pattern in string with replacement.

    Note: This method is based on String#replace.

    Parameters

    • string: string
    • pattern: RegExp | string
    • replacement: Function | string

    Returns string

    Returns the modified string.

  • see

    _.replace

    Parameters

    • Optional pattern: RegExp | string
    • Optional replacement: Function | string

    Returns string

rest

  • rest<TResult>(func: Function, start?: number): TResult
  • rest<TResult, TFunc>(func: TFunc, start?: number): TResult
  • Creates a function that invokes func with the this binding of the created function and arguments from start and beyond provided as an array.

    Note: This method is based on the rest parameter.

    Type parameters

    • TResult: Function

    Parameters

    • func: Function

      The function to apply a rest parameter to.

    • Optional start: number

      The start position of the rest parameter.

    Returns TResult

    Returns the new function.

  • see

    _.rest

    Type parameters

    • TResult: Function

    • TFunc: Function

    Parameters

    • func: TFunc
    • Optional start: number

    Returns TResult

result

  • result<TObject, TResult>(object: TObject, path: number | string | boolean | Array<number | string | boolean>, defaultValue?: TResult): TResult
  • This method is like _.get except that if the resolved value is a function it’s invoked with the this binding of its parent object and its result is returned.

    Type parameters

    • TObject

    • TResult

    Parameters

    • object: TObject

      The object to query.

    • path: number | string | boolean | Array<number | string | boolean>

      The path of the property to resolve.

    • Optional defaultValue: TResult

      The value returned if the resolved value is undefined.

    Returns TResult

    Returns the resolved value.

reverse

  • reverse(array: any[] | List<any>, ...values: any[]): any[]
  • Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on.

    Note: This method mutates array and is based on Array#reverse.

    memberof

    _

    category

    Array

    example

    var array = [1, 2, 3];

    _.reverse(array); // => [3, 2, 1]

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

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns array.

round

  • round(n: number, precision?: number): number
  • Calculates n rounded to precision.

    Parameters

    • n: number

      The number to round.

    • Optional precision: number

      The precision to round to.

    Returns number

    Returns the rounded number.

runInContext

  • Create a new pristine lodash function using the given context object.

    Parameters

    • Optional context: Object

      The context object.

    Returns LoDashStatic

    Returns a new lodash function.

sample

  • sample<T>(collection: Array<T>): T
  • sample<T>(collection: List<T>): T
  • sample<T>(collection: Dictionary<T>): T
  • Gets a random element from collection.

    static
    memberof

    _

    category

    Collection

    example

    _.sample([1, 2, 3, 4]); // => 2

    Type parameters

    • T

    Parameters

    • collection: Array<T>

      The collection to sample.

    Returns T

    Returns the random element.

  • see

    _.sample

    Type parameters

    • T

    Parameters

    • collection: List<T>

    Returns T

  • see

    _.sample

    Type parameters

    • T

    Parameters

    Returns T

sampleSize

  • sampleSize<T>(collection: Array<T>, n: number): T[]
  • sampleSize<T>(collection: List<T>, n: number): T[]
  • sampleSize<T>(collection: Dictionary<T>, n: number): T[]
  • Gets n random elements from collection.

    static
    memberof

    _

    category

    Collection

    example

    _.sampleSize([1, 2, 3, 4], 2); // => [3, 1]

    Type parameters

    • T

    Parameters

    • collection: Array<T>

      The collection to sample.

    • n: number

    Returns T[]

    Returns the random elements.

  • see

    _.sampleSize

    Type parameters

    • T

    Parameters

    • collection: List<T>
    • n: number

    Returns T[]

  • see

    _.sampleSize

    Type parameters

    • T

    Parameters

    Returns T[]

set

  • 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.

    Type parameters

    • TResult

    Parameters

    Returns TResult

    Returns object.

  • see

    _.set

    Type parameters

    • V

    • TResult

    Parameters

    Returns TResult

  • see

    _.set

    Type parameters

    • O

    • V

    • TResult

    Parameters

    Returns TResult

setWith

  • This method is like _.set except that it accepts customizer which is invoked to produce the objects of path. If customizer returns undefined path creation is handled by the method instead. The customizer is invoked with three arguments: (nsValue, key, nsObject).

    parem

    customizer The function to customize assigned values.

    Type parameters

    • TResult

    Parameters

    Returns TResult

    Returns object.

  • see

    _.setWith

    Type parameters

    • V

    • TResult

    Parameters

    Returns TResult

  • see

    _.setWith

    Type parameters

    • O

    • V

    • TResult

    Parameters

    Returns TResult

shuffle

  • shuffle<T>(collection: List<T> | Dictionary<T>): T[]
  • shuffle(collection: string): string[]
  • Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the new shuffled array.

  • see

    _.shuffle

    Parameters

    • collection: string

    Returns string[]

size

  • size<T>(collection: List<T> | Dictionary<T>): number
  • size(collection: string): number
  • Gets the size of collection by returning its length for array-like values or the number of own enumerable properties for objects.

    Type parameters

    • T

    Parameters

    Returns number

    Returns the size of collection.

  • see

    _.size

    Parameters

    • collection: string

    Returns number

slice

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

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to slice.

    • Optional start: number

      The start position.

    • Optional end: number

      The end position.

    Returns T[]

    Returns the slice of array.

snakeCase

  • snakeCase(string?: string): string
  • Converts string to snake case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the snake cased string.

some

  • 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).

    Type parameters

    • T

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional predicate: ListIterator<T, boolean>

      The function invoked per iteration.

    Returns boolean

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

  • see

    _.some

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.some

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.some

    Type parameters

    • T

    Parameters

    Returns boolean

  • see

    _.some

    Type parameters

    • TObject: __type

    • T

    Parameters

    Returns boolean

sortBy

  • Creates an array of elements, sorted in ascending order by the results of running each element in a collection through each iteratee. This method performs a stable sort, that is, it preserves the original sort order of equal elements. The iteratees are invoked with one argument: (value).

    static
    memberof

    _

    category

    Collection

    example

    var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 34 } ];

    _.sortBy(users, function(o) { return o.user; }); // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]

    _.sortBy(users, ['user', 'age']); // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]

    _.sortBy(users, 'user', function(o) { return Math.floor(o.age / 10); }); // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]

    Type parameters

    • T

    • TSort

    Parameters

    • collection: List<T>

      The collection to iterate over.

    • Optional iteratee: ListIterator<T, TSort>

    Returns T[]

    Returns the new sorted array.

  • see

    _.sortBy

    Type parameters

    • T

    • TSort

    Parameters

    Returns T[]

  • see

    _.sortBy

    Type parameters

    • T

    Parameters

    Returns T[]

  • see

    _.sortBy

    Type parameters

    • W: __type

    • T

    Parameters

    Returns T[]

  • see

    _.sortBy

    Type parameters

    • T

    Parameters

    Returns T[]

  • see

    _.sortBy

    Type parameters

    • T

    Parameters

    • collection: T[] | List<T>
    • iteratees: (string | Object | ListIterator<T, any>)[]

    Returns T[]

  • see

    _.sortBy

    Type parameters

    • T

    Parameters

    • collection: T[] | List<T>
    • Rest ...iteratees: (string | Object | ListIterator<T, boolean>)[]

    Returns T[]

sortedIndex

  • sortedIndex<T, TSort>(array: List<T>, value: T): number
  • sortedIndex<T>(array: List<T>, value: T): number
  • sortedIndex<T>(array: List<T>, value: T): number
  • sortedIndex<W, T>(array: List<T>, value: T): number
  • sortedIndex<T>(array: List<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.

    static
    memberof

    _

    category

    Array

    example

    _.sortedIndex([30, 50], 40); // => 1

    _.sortedIndex([4, 5], 4); // => 0

    Type parameters

    • T

    • TSort

    Parameters

    • array: List<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.

  • see

    _.sortedIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedIndex

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

sortedIndexBy

  • sortedIndexBy<T, TSort>(array: List<T>, value: T, iteratee: function): number
  • sortedIndexBy<T>(array: List<T>, value: T, iteratee: function): number
  • sortedIndexBy<T>(array: List<T>, value: T, iteratee: string): number
  • sortedIndexBy<W, T>(array: List<T>, value: T, iteratee: W): number
  • sortedIndexBy<T>(array: List<T>, value: T, iteratee: Object): 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).

    static
    memberof

    _

    category

    Array

    example

    var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };

    _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); // => 1

    // using the _.property iteratee shorthand _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); // => 0

    Type parameters

    • T

    • TSort

    Parameters

    • array: List<T>

      The sorted array to inspect.

    • value: T

      The value to evaluate.

    • iteratee: function
        • (x: T): TSort
        • Parameters

          • x: T

          Returns TSort

    Returns number

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

  • see

    _.sortedIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: function
        • (x: T): any
        • Parameters

          • x: T

          Returns any

    Returns number

  • see

    _.sortedIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: string

    Returns number

  • see

    _.sortedIndexBy

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: W

    Returns number

  • see

    _.sortedIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: Object

    Returns number

sortedIndexOf

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

    static
    memberof

    _

    category

    Array

    example

    _.sortedIndexOf([1, 1, 2, 2], 2); // => 2

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to search.

    • value: T

      The value to search for.

    Returns number

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

sortedLastIndex

  • sortedLastIndex<T, TSort>(array: List<T>, value: T): number
  • sortedLastIndex<T>(array: List<T>, value: T): number
  • sortedLastIndex<T>(array: List<T>, value: T): number
  • sortedLastIndex<W, T>(array: List<T>, value: T): number
  • sortedLastIndex<T>(array: List<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.

    static
    memberof

    _

    category

    Array

    example

    _.sortedLastIndex([4, 5], 4); // => 1

    Type parameters

    • T

    • TSort

    Parameters

    • array: List<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.

  • see

    _.sortedLastIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedLastIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedLastIndex

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

  • see

    _.sortedLastIndex

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T

    Returns number

sortedLastIndexBy

  • sortedLastIndexBy<T, TSort>(array: List<T>, value: T, iteratee: function): number
  • sortedLastIndexBy<T>(array: List<T>, value: T, iteratee: function): number
  • sortedLastIndexBy<T>(array: List<T>, value: T, iteratee: string): number
  • sortedLastIndexBy<W, T>(array: List<T>, value: T, iteratee: W): number
  • sortedLastIndexBy<T>(array: List<T>, value: T, iteratee: Object): 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).

    static
    memberof

    _

    category

    Array

    example

    // using the _.property iteratee shorthand _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); // => 1

    Type parameters

    • T

    • TSort

    Parameters

    • array: List<T>

      The sorted array to inspect.

    • value: T

      The value to evaluate.

    • iteratee: function
        • (x: T): TSort
        • Parameters

          • x: T

          Returns TSort

    Returns number

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

  • see

    _.sortedLastIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: function
        • (x: T): any
        • Parameters

          • x: T

          Returns any

    Returns number

  • see

    _.sortedLastIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: string

    Returns number

  • see

    _.sortedLastIndexBy

    Type parameters

    • W

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: W

    Returns number

  • see

    _.sortedLastIndexBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • value: T
    • iteratee: Object

    Returns number

sortedLastIndexOf

  • sortedLastIndexOf(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.lastIndexOf except that it performs a binary search on a sorted array.

    static
    memberof

    _

    category

    Array

    example

    _.sortedLastIndexOf([1, 1, 2, 2], 2); // => 3

    Parameters

    • array: any[] | List<any>

      The array to search.

    • Rest ...values: any[]

    Returns any[]

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

sortedUniq

  • sortedUniq<T>(array: List<T>): T[]
  • sortedUniq<T, TSort>(array: List<T>): T[]
  • This method is like _.uniq except that it's designed and optimized for sorted arrays.

    static
    memberof

    _

    category

    Array

    example

    _.sortedUniq([1, 1, 2]); // => [1, 2]

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to inspect.

    Returns T[]

    Returns the new duplicate free array.

  • see

    _.sortedUniq

    Type parameters

    • T

    • TSort

    Parameters

    Returns T[]

sortedUniqBy

  • sortedUniqBy<T>(array: List<T>, iteratee: ListIterator<T, any>): T[]
  • sortedUniqBy<T, TSort>(array: List<T>, iteratee: ListIterator<T, TSort>): T[]
  • sortedUniqBy<T>(array: List<T>, iteratee: string): T[]
  • sortedUniqBy<T>(array: List<T>, iteratee: Object): T[]
  • sortedUniqBy<TWhere, T>(array: List<T>, iteratee: TWhere): T[]
  • This method is like _.uniqBy except that it's designed and optimized for sorted arrays.

    static
    memberof

    _

    category

    Array

    example

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

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the new duplicate free array.

  • see

    _.sortedUniqBy

    Type parameters

    • T

    • TSort

    Parameters

    Returns T[]

  • see

    _.sortedUniqBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • iteratee: string

    Returns T[]

  • see

    _.sortedUniqBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • iteratee: Object

    Returns T[]

  • see

    _.sortedUniqBy

    Type parameters

    • TWhere: __type

    • T

    Parameters

    • array: List<T>
    • iteratee: TWhere

    Returns T[]

split

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

    Note: This method is based on String#split.

    Parameters

    • string: string
    • Optional separator: RegExp | string
    • Optional limit: number

    Returns string[]

    Returns the new array of string segments.

spread

  • spread<F, T>(func: F): T
  • spread<T>(func: Function): T
  • Creates a function that invokes func with the this binding of the created function and an array of arguments much like Function#apply.

    Note: This method is based on the spread operator.

    Type parameters

    • F: Function

    • T: Function

    Parameters

    • func: F

      The function to spread arguments over.

    Returns T

    Returns the new function.

  • see

    _.spread

    Type parameters

    • T: Function

    Parameters

    • func: Function

    Returns T

startCase

  • startCase(string?: string): string
  • Converts string to start case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the start cased string.

startsWith

  • startsWith(string?: string, target?: string, position?: number): boolean
  • Checks if string starts with the given target string.

    Parameters

    • Optional string: string

      The string to search.

    • Optional target: string

      The string to search for.

    • Optional position: number

      The position to search from.

    Returns boolean

    Returns true if string starts with target, else false.

subtract

  • subtract(minuend: number, subtrahend: number): number
  • Subtract two numbers.

    static
    memberof

    _

    category

    Math

    example

    _.subtract(6, 4); // => 2

    Parameters

    • minuend: number

      The first number in a subtraction.

    • subtrahend: number

      The second number in a subtraction.

    Returns number

    Returns the difference.

sum

  • sum<T>(collection: List<T>): number
  • sum(collection: List<number> | Dictionary<number>): number
  • Computes the sum of the values in array.

    static
    memberof

    _

    category

    Math

    example

    _.sum([4, 2, 8, 6]); // => 20

    Type parameters

    • T

    Parameters

    • collection: List<T>

    Returns number

    Returns the sum.

  • see

    _.sum

    Parameters

    Returns number

sumBy

  • 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).

    static
    memberof

    _

    category

    Math

    example

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

    _.sumBy(objects, function(o) { return o.n; }); // => 20

    // using the _.property iteratee shorthand _.sumBy(objects, 'n'); // => 20

    Type parameters

    • T

    Parameters

    Returns number

    Returns the sum.

  • see

    _.sumBy

    Type parameters

    • T

    Parameters

    Returns number

  • see

    _.sumBy

    Type parameters

    • T

    Parameters

    Returns number

  • see

    _.sumBy

    Type parameters

    • T

    Parameters

    Returns number

  • see

    _.sumBy

    Parameters

    Returns number

tail

  • tail<T>(array: List<T>): T[]
  • tail<T>(array: List<T>): T[]
  • Gets all but the first element of array.

    alias

    _.tail

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    Returns T[]

    Returns the slice of array.

  • see

    _.rest

    Type parameters

    • T

    Parameters

    Returns T[]

take

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    • Optional n: number

      The number of elements to take.

    Returns T[]

    Returns the slice of array.

takeRight

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

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to query.

    • Optional n: number

      The number of elements to take.

    Returns T[]

    Returns the slice of array.

takeRightWhile

  • takeRightWhile<TValue>(array: List<TValue>, predicate?: ListIterator<TValue, boolean>, thisArg?: any): TValue[]
  • takeRightWhile<TValue>(array: List<TValue>, predicate?: string, thisArg?: any): TValue[]
  • takeRightWhile<TWhere, TValue>(array: List<TValue>, predicate?: TWhere): TValue[]
  • Creates a slice of array with elements taken from the end. Elements are taken until predicate returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>

      The array to query.

    • Optional predicate: ListIterator<TValue, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns TValue[]

    Returns the slice of array.

  • see

    _.takeRightWhile

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: string
    • Optional thisArg: any

    Returns TValue[]

  • see

    _.takeRightWhile

    Type parameters

    • TWhere

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: TWhere

    Returns TValue[]

takeWhile

  • takeWhile<TValue>(array: List<TValue>, predicate?: ListIterator<TValue, boolean>, thisArg?: any): TValue[]
  • takeWhile<TValue>(array: List<TValue>, predicate?: string, thisArg?: any): TValue[]
  • takeWhile<TWhere, TValue>(array: List<TValue>, predicate?: TWhere): TValue[]
  • Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).

    If a property name is provided for predicate the created _.property style callback returns the property value of the given element.

    If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false.

    If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>

      The array to query.

    • Optional predicate: ListIterator<TValue, boolean>

      The function invoked per iteration.

    • Optional thisArg: any

      The this binding of predicate.

    Returns TValue[]

    Returns the slice of array.

  • see

    _.takeWhile

    Type parameters

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: string
    • Optional thisArg: any

    Returns TValue[]

  • see

    _.takeWhile

    Type parameters

    • TWhere

    • TValue

    Parameters

    • array: List<TValue>
    • Optional predicate: TWhere

    Returns TValue[]

tap

  • tap<T>(value: T, interceptor: function, thisArg?: any): T
  • This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations on intermediate results within the chain.

    parem

    thisArg The this binding of interceptor.

    Type parameters

    • T

    Parameters

    • value: T

      The value to provide to interceptor.

    • interceptor: function

      The function to invoke.

        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • Optional thisArg: any

    Returns T

    Returns value.

template

  • Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data properties may be accessed as free variables in the template. If a setting object is provided it takes precedence over _.templateSettings values.

    Note: In the development build _.template utilizes sourceURLs for easier debugging.

    For more information on precompiling templates see lodash's custom builds documentation.

    For more information on Chrome extension sandboxes see Chrome's extensions documentation.

    Parameters

    • string: string

      The template string.

    • Optional options: TemplateOptions

      The options object.

    Returns TemplateExecutor

    Returns the compiled template function.

throttle

  • Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled function return the result of the last func call.

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

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to throttle.

    • Optional wait: number

      The number of milliseconds to throttle invocations to.

    • Optional options: ThrottleSettings

      The options object.

    Returns T & Cancelable

    Returns the new throttled function.

thru

  • thru<T, TResult>(value: T, interceptor: function, thisArg?: any): TResult
  • This method is like _.tap except that it returns the result of interceptor.

    Type parameters

    • T

    • TResult

    Parameters

    • value: T

      The value to provide to interceptor.

    • interceptor: function

      The function to invoke.

        • (value: T): TResult
        • Parameters

          • value: T

          Returns TResult

    • Optional thisArg: any

      The this binding of interceptor.

    Returns TResult

    Returns the result of interceptor.

times

  • times<TResult>(n: number, iteratee: function): TResult[]
  • times(n: number): number[]
  • Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee is invoked with one argument; (index).

    Type parameters

    • TResult

    Parameters

    • n: number

      The number of times to invoke iteratee.

    • iteratee: function

      The function invoked per iteration.

        • (num: number): TResult
        • Parameters

          • num: number

          Returns TResult

    Returns TResult[]

    Returns the array of results.

  • see

    _.times

    Parameters

    • n: number

    Returns number[]

toArray

  • toArray<T>(value: List<T> | Dictionary<T> | NumericDictionary<T>): T[]
  • toArray<TValue, TResult>(value: TValue): TResult[]
  • toArray<TResult>(value?: any): TResult[]
  • Converts value to an array.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the converted array.

  • see

    _.toArray

    Type parameters

    • TValue

    • TResult

    Parameters

    • value: TValue

    Returns TResult[]

  • see

    _.toArray

    Type parameters

    • TResult

    Parameters

    • Optional value: any

    Returns TResult[]

toInteger

  • toInteger(value: any): number
  • Converts value to an integer.

    Note: This function is loosely based on ToInteger.

    static
    memberof

    _

    category

    Lang

    example

    _.toInteger(3); // => 3

    .toInteger(Number.MINVALUE); // => 0

    _.toInteger(Infinity); // => 1.7976931348623157e+308

    _.toInteger('3'); // => 3

    Parameters

    • value: any

      The value to convert.

    Returns number

    Returns the converted integer.

toLength

  • toLength(value: any): number
  • Converts value to an integer suitable for use as the length of an array-like object.

    Note: This method is based on ToLength.

    static
    memberof

    _

    category

    Lang

    example

    _.toLength(3); // => 3

    .toLength(Number.MINVALUE); // => 0

    _.toLength(Infinity); // => 4294967295

    _.toLength('3'); // => 3

    Parameters

    • value: any

      The value to convert.

    Returns number

    Returns the converted integer.

toLower

  • toLower(string?: string): string
  • Converts string, as a whole, to lower case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the lower cased string.

toNumber

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

    static
    memberof

    _

    category

    Lang

    example

    _.toNumber(3); // => 3

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

    _.toNumber(Infinity); // => Infinity

    _.toNumber('3'); // => 3

    Parameters

    • value: any

      The value to process.

    Returns number

    Returns the number.

toPairs

  • toPairs<T>(object?: T): any[][]
  • toPairs<T, TResult>(object?: T): TResult[][]
  • Creates an array of own enumerable key-value pairs for object.

    Type parameters

    • T: __type

    Parameters

    • Optional object: T

      The object to query.

    Returns any[][]

    Returns the new array of key-value pairs.

  • Type parameters

    • T: __type

    • TResult

    Parameters

    • Optional object: T

    Returns TResult[][]

toPairsIn

  • toPairsIn<T>(object?: T): any[][]
  • toPairsIn<T, TResult>(object?: T): TResult[][]
  • Creates an array of own and inherited enumerable key-value pairs for object.

    Type parameters

    • T: __type

    Parameters

    • Optional object: T

      The object to query.

    Returns any[][]

    Returns the new array of key-value pairs.

  • Type parameters

    • T: __type

    • TResult

    Parameters

    • Optional object: T

    Returns TResult[][]

toPath

  • toPath(value: any): string[]
  • Converts value to a property path array.

    static
    memberof

    _

    category

    Util

    example

    _.toPath('a.b.c'); // => ['a', 'b', 'c']

    _.toPath('a[0].b.c'); // => ['a', '0', 'b', 'c']

    var path = ['a', 'b', 'c'], newPath = _.toPath(path);

    console.log(newPath); // => ['a', 'b', 'c']

    console.log(path === newPath); // => false

    Parameters

    • value: any

      The value to convert.

    Returns string[]

    Returns the new property path array.

toPlainObject

  • toPlainObject<TResult>(value?: any): TResult
  • Converts value to a plain object flattening inherited enumerable properties of value to own properties of the plain object.

    Type parameters

    • TResult: __type

    Parameters

    • Optional value: any

      The value to convert.

    Returns TResult

    Returns the converted plain object.

toSafeInteger

  • toSafeInteger(value: any): number
  • Converts value to a safe integer. A safe integer can be compared and represented correctly.

    static
    memberof

    _

    category

    Lang

    example

    _.toSafeInteger(3); // => 3

    .toSafeInteger(Number.MINVALUE); // => 0

    _.toSafeInteger(Infinity); // => 9007199254740991

    _.toSafeInteger('3'); // => 3

    Parameters

    • value: any

      The value to convert.

    Returns number

    Returns the converted integer.

toString

  • toString(value: any): string
  • Converts value to a string if it's not one. An empty string is returned for null and undefined values. The sign of -0 is preserved.

    static
    memberof

    _

    category

    Lang

    example

    _.toString(null); // => ''

    _.toString(-0); // => '-0'

    _.toString([1, 2, 3]); // => '1,2,3'

    Parameters

    • value: any

      The value to process.

    Returns string

    Returns the string.

toUpper

  • toUpper(string?: string): string
  • Converts string, as a whole, to upper case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the upper cased string.

transform

  • An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of running each of its own enumerable properties through iteratee, with each invocation potentially mutating the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

    Type parameters

    • T

    • TResult

    Parameters

    • object: T[]

      The object to iterate over.

    • Optional iteratee: MemoVoidArrayIterator<T, TResult[]>

      The function invoked per iteration.

    • Optional accumulator: TResult[]

      The custom accumulator value.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns TResult[]

    Returns the accumulated value.

  • see

    _.transform

    Type parameters

    • T

    • TResult

    Parameters

    Returns Dictionary<TResult>

  • see

    _.transform

    Type parameters

    • T

    • TResult

    Parameters

    Returns Dictionary<TResult>

  • see

    _.transform

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult[]

trim

  • trim(string?: string, chars?: string): string
  • Removes leading and trailing whitespace or specified characters from string.

    Parameters

    • Optional string: string

      The string to trim.

    • Optional chars: string

      The characters to trim.

    Returns string

    Returns the trimmed string.

trimEnd

  • trimEnd(string?: string, chars?: string): string
  • Removes trailing whitespace or specified characters from string.

    Parameters

    • Optional string: string

      The string to trim.

    • Optional chars: string

      The characters to trim.

    Returns string

    Returns the trimmed string.

trimStart

  • trimStart(string?: string, chars?: string): string
  • Removes leading whitespace or specified characters from string.

    Parameters

    • Optional string: string

      The string to trim.

    • Optional chars: string

      The characters to trim.

    Returns string

    Returns the trimmed string.

truncate

  • Truncates string if it’s longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to "…".

    Parameters

    • Optional string: string

      The string to truncate.

    • Optional options: TruncateOptions

      The options object or maximum string length.

    Returns string

    Returns the truncated string.

unary

  • unary<T>(func: T): T
  • Creates a function that accepts up to one argument, ignoring any additional arguments.

    static
    memberof

    _

    category

    Function

    example

    _.map(['6', '8', '10'], _.unary(parseInt)); // => [6, 8, 10]

    Type parameters

    • T: Function

    Parameters

    • func: T

      The function to cap arguments for.

    Returns T

    Returns the new function.

unescape

  • unescape(string?: string): string
  • The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` in string to their corresponding characters.

    Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library like he.

    Parameters

    • Optional string: string

      The string to unescape.

    Returns string

    Returns the unescaped string.

union

  • union<T>(...arrays: List<T>[]): T[]
  • Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for equality comparisons.

    Type parameters

    • T

    Parameters

    • Rest ...arrays: List<T>[]

      The arrays to inspect.

    Returns T[]

    Returns the new array of combined values.

unionBy

  • unionBy<T>(arrays: T[] | List<T>, iteratee?: function): T[]
  • unionBy<T, W>(arrays: T[] | List<T>, iteratee?: W): T[]
  • unionBy<T>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, iteratee?: function): T[]
  • unionBy<T, W>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, iteratee?: W): T[]
  • unionBy<T>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, iteratee?: function): T[]
  • unionBy<T, W>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, iteratee?: W): T[]
  • unionBy<T>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, arrays4: T[] | List<T>, iteratee?: function): T[]
  • unionBy<T, W>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, arrays4: T[] | List<T>, iteratee?: W): T[]
  • unionBy<T>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, arrays4: T[] | List<T>, arrays5: T[] | List<T>, iteratee?: function): T[]
  • unionBy<T, W>(arrays1: T[] | List<T>, arrays2: T[] | List<T>, arrays3: T[] | List<T>, arrays4: T[] | List<T>, arrays5: T[] | List<T>, iteratee?: W): T[]
  • unionBy<T>(arrays: T[] | List<T>, ...iteratee: 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. The iteratee is invoked with one argument: (value).

    Type parameters

    • T

    Parameters

    • arrays: T[] | List<T>

      The arrays to inspect.

    • Optional iteratee: function

      The iteratee invoked per element.

        • (value: T): any
        • Parameters

          • value: T

          Returns any

    Returns T[]

    Returns the new array of combined values.

  • see

    _.unionBy

    Type parameters

    • T

    • W: Object

    Parameters

    • arrays: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • Optional iteratee: function
        • (value: T): any
        • Parameters

          • value: T

          Returns any

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    • W: Object

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • Optional iteratee: function
        • (value: T): any
        • Parameters

          • value: T

          Returns any

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    • W: Object

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • arrays4: T[] | List<T>
    • Optional iteratee: function
        • (value: T): any
        • Parameters

          • value: T

          Returns any

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    • W: Object

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • arrays4: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • arrays4: T[] | List<T>
    • arrays5: T[] | List<T>
    • Optional iteratee: function
        • (value: T): any
        • Parameters

          • value: T

          Returns any

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    • W: Object

    Parameters

    • arrays1: T[] | List<T>
    • arrays2: T[] | List<T>
    • arrays3: T[] | List<T>
    • arrays4: T[] | List<T>
    • arrays5: T[] | List<T>
    • Optional iteratee: W

    Returns T[]

  • see

    _.unionBy

    Type parameters

    • T

    Parameters

    • arrays: T[] | List<T>
    • Rest ...iteratee: any[]

    Returns T[]

unionWith

  • unionWith(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.union except that it accepts comparator which is invoked to compare elements of arrays. The comparator is invoked with two arguments: (arrVal, othVal).

    static
    memberof

    _

    category

    Array

    example

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];

    _.unionWith(objects, others, _.isEqual); // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns the new array of combined values.

uniq

  • uniq<T>(array: List<T>): T[]
  • uniq<T, TSort>(array: List<T>): T[]
  • Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only the first occurrence of each element is kept.

    static
    memberof

    _

    category

    Array

    example

    _.uniq([2, 1, 2]); // => [2, 1]

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to inspect.

    Returns T[]

    Returns the new duplicate free array.

  • see

    _.uniq

    Type parameters

    • T

    • TSort

    Parameters

    Returns T[]

uniqBy

  • uniqBy<T>(array: List<T>, iteratee: ListIterator<T, any>): T[]
  • uniqBy<T, TSort>(array: List<T>, iteratee: ListIterator<T, TSort>): T[]
  • uniqBy<T>(array: List<T>, iteratee: string): T[]
  • uniqBy<T>(array: List<T>, iteratee: Object): T[]
  • uniqBy<TWhere, T>(array: List<T>, iteratee: TWhere): 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 iteratee is invoked with one argument: (value).

    static
    memberof

    _

    category

    Array

    example

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

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

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the new duplicate free array.

  • see

    _.uniqBy

    Type parameters

    • T

    • TSort

    Parameters

    Returns T[]

  • see

    _.uniqBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • iteratee: string

    Returns T[]

  • see

    _.uniqBy

    Type parameters

    • T

    Parameters

    • array: List<T>
    • iteratee: Object

    Returns T[]

  • see

    _.uniqBy

    Type parameters

    • TWhere: __type

    • T

    Parameters

    • array: List<T>
    • iteratee: TWhere

    Returns T[]

uniqWith

  • uniqWith(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.uniq except that it accepts comparator which is invoked to compare elements of array. The comparator is invoked with two arguments: (arrVal, othVal).

    static
    memberof

    _

    category

    Array

    example

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];

    _.uniqWith(objects, _.isEqual); // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]

    Parameters

    • array: any[] | List<any>

      The array to inspect.

    • Rest ...values: any[]

    Returns any[]

    Returns the new duplicate free array.

uniqueId

  • uniqueId(prefix?: string): string
  • Generates a unique ID. If prefix is provided the ID is appended to it.

    Parameters

    • Optional prefix: string

      The value to prefix the ID with.

    Returns string

    Returns the unique ID.

unset

  • Removes the property at path of object.

    Note: This method mutates object.

    Type parameters

    • T

    Parameters

    Returns boolean

    Returns true if the property is deleted, else false.

unzip

  • This method is like _.zip except that it accepts an array of grouped elements and creates an array regrouping the elements to their pre-zip configuration.

    Type parameters

    • T

    Parameters

    • array: List<List<T>>

      The array of grouped elements to process.

    Returns T[][]

    Returns the new array of regrouped elements.

unzipWith

  • unzipWith<TArray, TResult>(array: List<List<TArray>>, iteratee?: MemoIterator<TArray, TResult>, thisArg?: any): TResult[]
  • This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, group).

    Type parameters

    • TArray

    • TResult

    Parameters

    • array: List<List<TArray>>

      The array of grouped elements to process.

    • Optional iteratee: MemoIterator<TArray, TResult>

      The function to combine regrouped values.

    • Optional thisArg: any

      The this binding of iteratee.

    Returns TResult[]

    Returns the new array of regrouped elements.

upperCase

  • upperCase(string?: string): string
  • Converts string, as space separated words, to upper case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the upper cased string.

upperFirst

  • upperFirst(string?: string): string
  • Converts the first character of string to upper case.

    Parameters

    • Optional string: string

      The string to convert.

    Returns string

    Returns the converted string.

values

  • values<T>(object?: any): T[]
  • Creates an array of the own enumerable property values of object.

    Type parameters

    • T

    Parameters

    • Optional object: any

      The object to query.

    Returns T[]

    Returns an array of property values.

valuesIn

  • valuesIn<T>(object?: any): T[]
  • Creates an array of the own and inherited enumerable property values of object.

    Type parameters

    • T

    Parameters

    • Optional object: any

      The object to query.

    Returns T[]

    Returns the array of property values.

without

  • without<T>(array: List<T>, ...values: T[]): T[]
  • Creates an array excluding all provided values using SameValueZero for equality comparisons.

    Type parameters

    • T

    Parameters

    • array: List<T>

      The array to filter.

    • Rest ...values: T[]

      The values to exclude.

    Returns T[]

    Returns the new array of filtered values.

words

  • words(string?: string, pattern?: string | RegExp): string[]
  • Splits string into an array of its words.

    Parameters

    • Optional string: string

      The string to inspect.

    • Optional pattern: string | RegExp

      The pattern to match words.

    Returns string[]

    Returns the words of string.

wrap

  • wrap<V, W, R>(value: V, wrapper: W): R
  • wrap<V, R>(value: V, wrapper: Function): R
  • wrap<R>(value: any, wrapper: Function): R
  • Creates a function that provides value to the wrapper function as its first argument. Any additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is invoked with the this binding of the created function.

    Type parameters

    • V

    • W: Function

    • R: Function

    Parameters

    • value: V

      The value to wrap.

    • wrapper: W

      The wrapper function.

    Returns R

    Returns the new function.

  • see

    _.wrap

    Type parameters

    • V

    • R: Function

    Parameters

    • value: V
    • wrapper: Function

    Returns R

  • see

    _.wrap

    Type parameters

    • R: Function

    Parameters

    • value: any
    • wrapper: Function

    Returns R

xor

  • xor<T>(...arrays: List<T>[]): T[]
  • Creates an array of unique values that is the symmetric difference of the provided arrays.

    Type parameters

    • T

    Parameters

    • Rest ...arrays: List<T>[]

      The arrays to inspect.

    Returns T[]

    Returns the new array of values.

xorBy

  • xorBy(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.xor except that it accepts iteratee which is invoked for each element of each arrays to generate the criterion by which uniqueness is computed. The iteratee is invoked with one argument: (value).

    static
    memberof

    _

    category

    Array

    example

    _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); // => [1.2, 4.3]

    // using the _.property iteratee shorthand _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 2 }]

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns the new array of values.

xorWith

  • xorWith(array: any[] | List<any>, ...values: any[]): any[]
  • This method is like _.xor except that it accepts comparator which is invoked to compare elements of arrays. The comparator is invoked with two arguments: (arrVal, othVal).

    static
    memberof

    _

    category

    Array

    example

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];

    _.xorWith(objects, others, _.isEqual); // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]

    Parameters

    • array: any[] | List<any>
    • Rest ...values: any[]

    Returns any[]

    Returns the new array of values.

zip

  • zip<T>(...arrays: List<T>[]): T[][]
  • Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on.

    Type parameters

    • T

    Parameters

    • Rest ...arrays: List<T>[]

      The arrays to process.

    Returns T[][]

    Returns the new array of grouped elements.

zipObject

  • The inverse of _.pairs; this method returns an object composed from arrays of property names and values. Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of property names and one of corresponding values.

    Type parameters

    • TValues

    • TResult: __type

    Parameters

    Returns TResult

    Returns the new object.

  • see

    _.zipObject

    Type parameters

    • TResult: __type

    Parameters

    Returns TResult

  • see

    _.zipObject

    Parameters

    Returns Dictionary<any>

zipWith

  • zipWith<TResult>(...args: any[]): TResult[]
  • This method is like _.zip except that it accepts an iteratee to specify how grouped values should be combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, group).

    Type parameters

    • TResult

    Parameters

    • Rest ...args: any[]

    Returns TResult[]

    Returns the new array of grouped elements.