Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/path

Index

References

Interfaces

Functions

References

Renames and re-exports path

Functions

  • path<K, O>(path: [K], obj: O): O[K]
  • path<K>(path: [K]): <O>(obj: O) => O[K]
  • path<T>(path: Paths, obj: any): T
  • path<T>(path: Paths): (obj: any) => T
  • Retrieve the value at a given path.

    example
     path(['a', 'b'], {a: {b: 2}}); //=> 2
    path(['a', 'b'], {c: {b: 2}}); //=> undefined

    Type parameters

    • K: string | number | symbol

    • O: Record<K, any>

    Parameters

    • path: [K]
    • obj: O

      The object to retrieve the nested property from.

    Returns O[K]

    The data at path.

  • Retrieve the value at a given path.

    example
     path(['a', 'b'], {a: {b: 2}}); //=> 2
    path(['a', 'b'], {c: {b: 2}}); //=> undefined

    Type parameters

    • K: string | number | symbol

    Parameters

    • path: [K]

    Returns <O>(obj: O) => O[K]

    The data at path.

      • <O>(obj: O): O[K]
      • Type parameters

        • O: Record<K, any>

        Parameters

        • obj: O

        Returns O[K]

  • Retrieve the value at a given path.

    example
     path(['a', 'b'], {a: {b: 2}}); //=> 2
    path(['a', 'b'], {c: {b: 2}}); //=> undefined

    Type parameters

    • T

    Parameters

    • path: Paths
    • obj: any

      The object to retrieve the nested property from.

    Returns T

    The data at path.

  • Retrieve the value at a given path.

    example
     path(['a', 'b'], {a: {b: 2}}); //=> 2
    path(['a', 'b'], {c: {b: 2}}); //=> undefined

    Type parameters

    • T

    Parameters

    Returns (obj: any) => T

    The data at path.

      • (obj: any): T
      • Parameters

        • obj: any

        Returns T

Generated using TypeDoc