Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • LoDashStatic

Index

Methods

assign

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

    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

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TObject & TSource

    Returns object.

  • see

    assign

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    assign

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    assign

    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

    _.assign

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assign

    Parameters

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

    Returns any

assignIn

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

    Note: This method mutates object.

    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

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TObject & TSource

    Returns object.

  • see

    assignIn

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    assignIn

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    assignIn

    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

    _.assignIn

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignIn

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

assignInWith

  • assignInWith<TObject, TSource>(object: TObject, source: TSource, customizer: AssignCustomizer): TObject & TSource
  • assignInWith<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer): TObject & TSource1 & TSource2
  • assignInWith<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer): TObject & TSource1 & TSource2 & TSource3
  • assignInWith<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer): TObject & TSource1 & TSource2 & TSource3 & TSource4
  • assignInWith<TObject>(object: TObject): TObject
  • assignInWith<TResult>(object: any, ...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.

    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

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • customizer: AssignCustomizer

    Returns TObject & TSource

    Returns object.

  • see

    assignInWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    assignInWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    assignInWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

  • see

    _.assignInWith

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignInWith

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

assignWith

  • assignWith<TObject, TSource>(object: TObject, source: TSource, customizer: AssignCustomizer): TObject & TSource
  • assignWith<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2, customizer: AssignCustomizer): TObject & TSource1 & TSource2
  • assignWith<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: AssignCustomizer): TObject & TSource1 & TSource2 & TSource3
  • assignWith<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: AssignCustomizer): TObject & TSource1 & TSource2 & TSource3 & TSource4
  • assignWith<TObject>(object: TObject): TObject
  • assignWith<TResult>(object: any, ...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.

    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

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • customizer: AssignCustomizer

    Returns TObject & TSource

    Returns object.

  • see

    assignWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    assignWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    assignWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

  • see

    _.assignWith

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.assignWith

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

at

  • 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

    • object: List<T> | Dictionary<T> | NumericDictionary<T> | null | undefined

      The object to iterate over.

    • Rest ...props: PropertyPath[]

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

    Returns T[]

    Returns the new array of picked elements.

  • see

    _.at

    Type parameters

    • T: object

    Parameters

    • object: T | null | undefined
    • Rest ...props: Array<Many<keyof T>>

    Returns Array<T[keyof T]>

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.

defaults

  • defaults<TObject, TSource>(object: TObject, source: TSource): TSource & TObject
  • defaults<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TSource2 & TSource1 & TObject
  • defaults<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TSource3 & TSource2 & TSource1 & TObject
  • defaults<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TSource4 & TSource3 & TSource2 & TSource1 & TObject
  • defaults<TObject>(object: TObject): TObject
  • defaults(object: any, ...sources: any[]): any
  • 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

    • TObject

    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource

    Returns TSource & TObject

    The destination object.

  • see

    _.defaults

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TSource2 & TSource1 & TObject

  • see

    _.defaults

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TSource3 & TSource2 & TSource1 & TObject

  • see

    _.defaults

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

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

    Returns TSource4 & TSource3 & TSource2 & TSource1 & TObject

  • see

    _.defaults

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.defaults

    Parameters

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

    Returns any

defaultsDeep

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

    Parameters

    • object: any

      The destination object.

    • Rest ...sources: any[]

      The source objects.

    Returns any

    Returns object.

entries

  • entries<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>
  • entries(object?: undefined | object): Array<[string, any]>
  • see

    _.toPairs

    Type parameters

    • T

    Parameters

    Returns Array<[string, T]>

  • see

    _.toPairs

    Parameters

    • Optional object: undefined | object

    Returns Array<[string, any]>

entriesIn

  • entriesIn<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>
  • entriesIn(object?: undefined | object): Array<[string, any]>
  • see

    _.entriesIn

    Type parameters

    • T

    Parameters

    Returns Array<[string, T]>

  • see

    _.entriesIn

    Parameters

    • Optional object: undefined | object

    Returns Array<[string, any]>

extend

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

    _.extend

    Type parameters

    • TObject

    • TSource

    Parameters

    • object: TObject
    • source: TSource

    Returns TObject & TSource

  • see

    _.extend

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    _.extend

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    _.extend

    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

    _.extend

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.extend

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

extendWith

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

    _.extendWith

    Type parameters

    • TObject

    • TSource

    Parameters

    Returns TObject & TSource

  • see

    _.extendWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    Parameters

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

    Returns TObject & TSource1 & TSource2

  • see

    _.extendWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3

  • see

    _.extendWith

    Type parameters

    • TObject

    • TSource1

    • TSource2

    • TSource3

    • TSource4

    Parameters

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

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

  • see

    _.extendWith

    Type parameters

    • TObject

    Parameters

    • object: TObject

    Returns TObject

  • see

    _.extendWith

    Type parameters

    • TResult

    Parameters

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

    Returns TResult

findKey

  • findKey<T>(object: T | null | undefined, predicate?: ObjectIteratee<T>): string | undefined
  • This method is like _.find except that it returns the key of the first element predicate returns truthy for instead of the element itself.

    Type parameters

    • T

    Parameters

    • object: T | null | undefined

      The object to search.

    • Optional predicate: ObjectIteratee<T>

      The function invoked per iteration.

    Returns string | undefined

    Returns the key of the matched element, else undefined.

findLastKey

  • findLastKey<T>(object: T | null | undefined, predicate?: ObjectIteratee<T>): string | undefined
  • This method is like _.findKey except that it iterates over elements of a collection in the opposite order.

    Type parameters

    • T

    Parameters

    • object: T | null | undefined

      The object to search.

    • Optional predicate: ObjectIteratee<T>

      The function invoked per iteration.

    Returns string | undefined

    Returns the key of the matched element, else undefined.

forIn

  • forIn<T>(object: T, iteratee?: ObjectIterator<T, any>): T
  • forIn<T>(object: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined
  • Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The iteratee is invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

    Type parameters

    • T

    Parameters

    • object: T

      The object to iterate over.

    • Optional iteratee: ObjectIterator<T, any>

      The function invoked per iteration.

    Returns T

    Returns object.

  • see

    _.forIn

    Type parameters

    • T

    Parameters

    • object: T | null | undefined
    • Optional iteratee: ObjectIterator<T, any>

    Returns T | null | undefined

forInRight

  • forInRight<T>(object: T, iteratee?: ObjectIterator<T, any>): T
  • forInRight<T>(object: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined
  • This method is like _.forIn except that it iterates over properties of object in the opposite order.

    Type parameters

    • T

    Parameters

    • object: T

      The object to iterate over.

    • Optional iteratee: ObjectIterator<T, any>

      The function invoked per iteration.

    Returns T

    Returns object.

  • see

    _.forInRight

    Type parameters

    • T

    Parameters

    • object: T | null | undefined
    • Optional iteratee: ObjectIterator<T, any>

    Returns T | null | undefined

forOwn

  • forOwn<T>(object: T, iteratee?: ObjectIterator<T, any>): T
  • forOwn<T>(object: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined
  • Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is invoked with three arguments: (value, key, object). Iteratee functions may exit iteration early by explicitly returning false.

    Type parameters

    • T

    Parameters

    • object: T

      The object to iterate over.

    • Optional iteratee: ObjectIterator<T, any>

      The function invoked per iteration.

    Returns T

    Returns object.

  • see

    _.forOwn

    Type parameters

    • T

    Parameters

    • object: T | null | undefined
    • Optional iteratee: ObjectIterator<T, any>

    Returns T | null | undefined

forOwnRight

  • forOwnRight<T>(object: T, iteratee?: ObjectIterator<T, any>): T
  • forOwnRight<T>(object: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined
  • This method is like _.forOwn except that it iterates over properties of object in the opposite order.

    Type parameters

    • T

    Parameters

    • object: T

      The object to iterate over.

    • Optional iteratee: ObjectIterator<T, any>

      The function invoked per iteration.

    Returns T

    Returns object.

  • see

    _.forOwnRight

    Type parameters

    • T

    Parameters

    • object: T | null | undefined
    • Optional iteratee: ObjectIterator<T, any>

    Returns T | null | undefined

functions

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

    category

    Object

    example

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

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

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

    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.

    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<TObject, TKey>(object: TObject, path: TKey | [TKey]): TObject[TKey]
  • get<TObject, TKey>(object: TObject | null | undefined, path: TKey | [TKey]): TObject[TKey] | undefined
  • get<TObject, TKey, TDefault>(object: TObject | null | undefined, path: TKey | [TKey], defaultValue: TDefault): TObject[TKey] | TDefault
  • get<T>(object: NumericDictionary<T>, path: number): T
  • get<T>(object: NumericDictionary<T> | null | undefined, path: number): T | undefined
  • get<T, TDefault>(object: NumericDictionary<T> | null | undefined, path: number, defaultValue: TDefault): T | TDefault
  • get<TDefault>(object: null | undefined, path: PropertyPath, defaultValue: TDefault): TDefault
  • get(object: null | undefined, path: PropertyPath): undefined
  • get(object: any, path: PropertyPath, defaultValue?: any): any
  • Gets the property value at path of object. If the resolved value is undefined the defaultValue is used in its place.

    Type parameters

    • TObject: object

    • TKey: keyof TObject

    Parameters

    • object: TObject

      The object to query.

    • path: TKey | [TKey]

      The path of the property to get.

    Returns TObject[TKey]

    Returns the resolved value.

  • see

    _.get

    Type parameters

    • TObject: object

    • TKey: keyof TObject

    Parameters

    • object: TObject | null | undefined
    • path: TKey | [TKey]

    Returns TObject[TKey] | undefined

  • see

    _.get

    Type parameters

    • TObject: object

    • TKey: keyof TObject

    • TDefault

    Parameters

    • object: TObject | null | undefined
    • path: TKey | [TKey]
    • defaultValue: TDefault

    Returns TObject[TKey] | TDefault

  • see

    _.get

    Type parameters

    • T

    Parameters

    Returns T

  • see

    _.get

    Type parameters

    • T

    Parameters

    Returns T | undefined

  • see

    _.get

    Type parameters

    • T

    • TDefault

    Parameters

    • object: NumericDictionary<T> | null | undefined
    • path: number
    • defaultValue: TDefault

    Returns T | TDefault

  • see

    _.get

    Type parameters

    • TDefault

    Parameters

    • object: null | undefined
    • path: PropertyPath
    • defaultValue: TDefault

    Returns TDefault

  • see

    _.get

    Parameters

    Returns undefined

  • see

    _.get

    Parameters

    Returns any

has

  • Checks if path is a direct property of object.

    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

    Parameters

    • object: T

      The object to query.

    • path: PropertyPath

      The path to check.

    Returns boolean

    Returns true if path exists, else false.

hasIn

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

    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

    Parameters

    • object: T

      The object to query.

    • path: PropertyPath

      The path to check.

    Returns boolean

    Returns true if path exists, else false.

invert

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

    Parameters

    • object: object

      The object to invert.

    Returns Dictionary<string>

    Returns the new inverted object.

invertBy

  • This method is like _.invert except that the inverted object is generated from the results of running each element of object through iteratee. The corresponding inverted value of each inverted key is an array of keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value).

    Type parameters

    • T

    Parameters

    Returns Dictionary<string[]>

    Returns the new inverted object.

  • see

    _.invertBy

    Type parameters

    • T: object

    Parameters

    • object: T | null | undefined
    • Optional interatee: ValueIteratee<T[keyof T]>

    Returns Dictionary<string[]>

invoke

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

    Parameters

    • object: any

      The object to query.

    • path: PropertyPath

      The path of the method to invoke.

    • Rest ...args: any[]

      The arguments to invoke the method with.

    Returns any

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.

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

    Parameters

    • object: List<T> | null | undefined

      The object to iterate over.

    • Optional iteratee: ListIteratee<T>

      The function invoked per iteration.

    Returns Dictionary<T>

    Returns the new mapped object.

  • see

    _.mapKeys

    Type parameters

    • T: object

    Parameters

    Returns Dictionary<T[keyof 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 invoked with three arguments: (value, key, object).

    Type parameters

    • TResult

    Parameters

    Returns NumericDictionary<TResult>

    Returns the new mapped object.

  • see

    _.mapValues TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, but TypeScript cannot select overload signatures based on number vs string index key type.

    Type parameters

    • T

    • TResult

    Parameters

    Returns Dictionary<TResult>

  • see

    _.mapValues

    Type parameters

    • T: object

    • TResult

    Parameters

    Returns object

  • see

    _.mapValues TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, but TypeScript cannot select overload signatures based on number vs string index key type.

    Type parameters

    • T

    Parameters

    Returns Dictionary<boolean>

  • see

    _.mapValues

    Type parameters

    • T: object

    Parameters

    • obj: T | null | undefined
    • iteratee: object

    Returns object

  • see

    _.mapValues TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, but TypeScript cannot select overload signatures based on number vs string index key type.

    Type parameters

    • T

    • TKey: keyof T

    Parameters

    Returns Dictionary<T[TKey]>

  • see

    _.mapValues TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, but TypeScript cannot select overload signatures based on number vs string index key type.

    Type parameters

    • T

    Parameters

    Returns Dictionary<any>

  • see

    _.mapValues

    Type parameters

    • T: object

    Parameters

    • obj: T | null | undefined
    • iteratee: string

    Returns object

  • see

    _.mapValues

    Parameters

    • obj: string | null | undefined

    Returns NumericDictionary<string>

  • see

    _.mapValues TODO: This would be better if we had a separate overload for obj: NumericDictionary that returned a NumericDictionary, but TypeScript cannot select overload signatures based on number vs string index key type.

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.mapValues

    Type parameters

    • T: object

    Parameters

    • obj: T

    Returns T

  • see

    _.mapValues

    Type parameters

    • T: object

    Parameters

    • obj: T | null | undefined

    Returns PartialObject<T>

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(object: any, ...otherArgs: any[]): any
  • 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.

    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

    Parameters

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

    Returns any

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(object: any, ...otherArgs: any[]): any
  • This method is like _.merge except that it accepts customizer which is invoked to produce the merged values of the destination and source properties. If customizer returns undefined merging is handled by the method instead. The customizer is invoked with seven arguments: (objValue, srcValue, key, object, source, stack).

    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

    Parameters

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

    Returns any

omit

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

    category

    Object

    example

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

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

    Type parameters

    Parameters

    • object: T | null | undefined

      The source object.

    • Rest ...paths: Array<Many<PropertyName>>

    Returns T

    Returns the new object.

  • see

    _.omit

    Type parameters

    • T: object

    • K: keyof T

    Parameters

    • object: T | null | undefined
    • Rest ...paths: Array<Many<K>>

    Returns Omit<T, K>

  • see

    _.omit

    Type parameters

    • T: object

    Parameters

    Returns PartialObject<T>

omitBy

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

    category

    Object

    example

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

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

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

    Returns the new object.

  • see

    _.omitBy

    Type parameters

    • T

    Parameters

    Returns NumericDictionary<T>

  • see

    _.omitBy

    Type parameters

    • T: object

    Parameters

    Returns PartialObject<T>

pick

  • Creates an object composed of the picked object properties.

    category

    Object

    example

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

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

    Type parameters

    • T: object

    • U: keyof T

    Parameters

    • object: T

      The source object.

    • Rest ...props: Array<Many<U>>

    Returns Pick<T, U>

    Returns the new object.

  • see

    _.pick

    Type parameters

    • T

    Parameters

    • object: T | null | undefined
    • Rest ...props: PropertyPath[]

    Returns PartialDeep<T>

pickBy

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

    category

    Object

    example

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

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

    Type parameters

    • T

    • S: T

    Parameters

    Returns Dictionary<S>

    Returns the new object.

  • see

    _.pickBy

    Type parameters

    • T

    • S: T

    Parameters

    Returns NumericDictionary<S>

  • see

    _.pickBy

    Type parameters

    • T

    Parameters

    Returns Dictionary<T>

  • see

    _.pickBy

    Type parameters

    • T

    Parameters

    Returns NumericDictionary<T>

  • see

    _.pickBy

    Type parameters

    • T: object

    Parameters

    Returns PartialObject<T>

result

  • result<TResult>(object: any, path: PropertyPath, defaultValue?: TResult | function): 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

    • TResult

    Parameters

    • object: any

      The object to query.

    • path: PropertyPath

      The path of the property to resolve.

    • Optional defaultValue: TResult | function

      The value returned if the resolved value is undefined.

    Returns TResult

    Returns the resolved value.

set

  • set<T>(object: T, path: PropertyPath, value: any): T
  • set<TResult>(object: object, path: PropertyPath, value: any): TResult
  • 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

    • T: object

    Parameters

    • object: T

      The object to modify.

    • path: PropertyPath

      The path of the property to set.

    • value: any

      The value to set.

    Returns T

    Returns object.

  • see

    _.set

    Type parameters

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

    Type parameters

    • T: object

    Parameters

    • object: T

      The object to modify.

    • path: PropertyPath

      The path of the property to set.

    • value: any

      The value to set.

    • Optional customizer: SetWithCustomizer<T>

      The function to customize assigned values.

    Returns T

    Returns object.

  • Type parameters

    • T: object

    • TResult

    Parameters

    Returns TResult

toPairs

  • toPairs<T>(object?: Dictionary<T> | NumericDictionary<T>): Array<[string, T]>
  • toPairs(object?: undefined | object): Array<[string, any]>
  • Creates an array of own enumerable key-value pairs for object.

    Type parameters

    • T

    Parameters

    Returns Array<[string, T]>

    Returns the new array of key-value pairs.

  • see

    _.toPairs

    Parameters

    • Optional object: undefined | object

    Returns Array<[string, any]>

toPairsIn

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

    Type parameters

    • T

    Parameters

    Returns Array<[string, T]>

    Returns the new array of key-value pairs.

  • see

    _.toPairsIn

    Parameters

    • Optional object: undefined | object

    Returns Array<[string, any]>

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

    • iteratee: MemoVoidArrayIterator<T, TResult[]>

      The function invoked per iteration.

    • Optional accumulator: TResult[]

      The custom accumulator value.

    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[]

  • see

    _.transform

    Parameters

    • object: any[]

    Returns any[]

  • see

    _.transform

    Parameters

    • object: object

    Returns Dictionary<any>

unset

  • Removes the property at path of object.

    Note: This method mutates object.

    Parameters

    • object: any

      The object to modify.

    • path: PropertyPath

      The path of the property to unset.

    Returns boolean

    Returns true if the property is deleted, else false.

update

  • update(object: object, path: PropertyPath, updater: function): any
  • This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to customize path creation. The updater is invoked with one argument: (value).

    Parameters

    • object: object

      The object to modify.

    • path: PropertyPath

      The path of the property to set.

    • updater: function

      The function to produce the updated value.

        • (value: any): any
        • Parameters

          • value: any

          Returns any

    Returns any

    Returns object.

updateWith

  • This method is like _.update 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).

    Note: This method mutates object.

    since

    4.6.0

    category

    Object

    example

    var object = {};

    _.updateWith(object, '[0][1]', _.constant('a'), Object); // => { '0': { '1': 'a' } }

    Type parameters

    • T: object

    Parameters

    • object: T

      The object to modify.

    • path: PropertyPath

      The path of the property to set.

    • updater: function

      The function to produce the updated value.

        • (oldValue: any): any
        • Parameters

          • oldValue: any

          Returns any

    • Optional customizer: SetWithCustomizer<T>

    Returns T

    Returns object.

  • see

    _.updateWith

    Type parameters

    • T: object

    • TResult

    Parameters

    • object: T
    • path: PropertyPath
    • updater: function
        • (oldValue: any): any
        • Parameters

          • oldValue: any

          Returns any

    • Optional customizer: SetWithCustomizer<T>

    Returns TResult

values

  • values<T>(object: Dictionary<T> | NumericDictionary<T> | List<T> | null | undefined): T[]
  • values<T>(object: T | null | undefined): Array<T[keyof T]>
  • values(object: any): any[]
  • Creates an array of the own enumerable property values of object.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns an array of property values.

  • see

    _.values

    Type parameters

    • T: object

    Parameters

    • object: T | null | undefined

    Returns Array<T[keyof T]>

  • see

    _.values

    Parameters

    • object: any

    Returns any[]

valuesIn

  • Creates an array of the own and inherited enumerable property values of object.

    Type parameters

    • T

    Parameters

    Returns T[]

    Returns the array of property values.

  • see

    _.valuesIn

    Type parameters

    • T: object

    Parameters

    • object: T | null | undefined

    Returns Array<T[keyof T]>

Generated using TypeDoc