Options
All
  • Public
  • Public/Protected
  • All
Menu

Module get

Index

References

Functions Object

References

Renames and re-exports get

Object Functions

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

    since

    5.3.0

    see

    has, hasIn, set, unset

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

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

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

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

    Parameters

    • object: any

      The object to query.

    • path: string[]

      The path of the property to get.

    • Optional defaultValue: any

      The value returned for undefined resolved values.

    Returns any

    Returns the resolved value.

  • Parameters

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

    Returns any