Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/pathApply

Index

References

Functions

References

Renames and re-exports pathApply

Functions

  • pathApply<K, O, R>(path: [K], fn: ObjBase<K, O[K], R>, obj: O): R
  • pathApply<K, V, R>(path: [K], fn: ObjBase<K, V, R>): (obj: any) => R
  • pathApply<K>(path: [K]): { <O, R>(fn: ObjBase<K, O[K], R>, obj: O): R; <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R }
  • pathApply<V, R>(path: Paths, fn: ObjBase<Paths, V, R>, obj: any): R
  • pathApply<V, R>(path: Paths, fn: ObjBase<Paths, V, R>): (obj: any) => R
  • pathApply(path: Paths): { <V, R>(fn: ObjBase<Paths, V, R>, obj: any): R; <V, R>(fn: ObjBase<Paths, V, R>): (obj: any) => R }
  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Type parameters

    • K: string | number | symbol

    • O: Record<K, any>

    • R

    Parameters

    • path: [K]
    • fn: ObjBase<K, O[K], R>

      function to apply

    • obj: O

      The object to retrieve the nested property from.

    Returns R

    result of calling fn with nested property.

  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Type parameters

    • K: string | number | symbol

    • V

    • R

    Parameters

    • path: [K]
    • fn: ObjBase<K, V, R>

      function to apply

    Returns (obj: any) => R

    result of calling fn with nested property.

      • (obj: any): R
      • Parameters

        • obj: any

        Returns R

  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Type parameters

    • K: string | number | symbol

    Parameters

    • path: [K]

    Returns { <O, R>(fn: ObjBase<K, O[K], R>, obj: O): R; <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R }

    result of calling fn with nested property.

      • <O, R>(fn: ObjBase<K, O[K], R>, obj: O): R
      • <V, R>(fn: ObjBase<K, V, R>): (obj: any) => R
      • Type parameters

        • O: Record<K, any>

        • R

        Parameters

        Returns R

      • Type parameters

        • V

        • R

        Parameters

        Returns (obj: any) => R

          • (obj: any): R
          • Parameters

            • obj: any

            Returns R

  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Type parameters

    • V

    • R

    Parameters

    • path: Paths
    • fn: ObjBase<Paths, V, R>

      function to apply

    • obj: any

      The object to retrieve the nested property from.

    Returns R

    result of calling fn with nested property.

  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Type parameters

    • V

    • R

    Parameters

    Returns (obj: any) => R

    result of calling fn with nested property.

      • (obj: any): R
      • Parameters

        • obj: any

        Returns R

  • Returns the result of fn with given value at path.

    example
     pathApply(['a', 'b'], x => 'is ' + x, {a: {b: 2}}); //=> is 2
    pathApply(['a', 'b'], x => x > 0, {a: {b: 2}}); //=> true

    Parameters

    Returns { <V, R>(fn: ObjBase<Paths, V, R>, obj: any): R; <V, R>(fn: ObjBase<Paths, V, R>): (obj: any) => R }

    result of calling fn with nested property.

      • Type parameters

        • V

        • R

        Parameters

        Returns R

      • Type parameters

        • V

        • R

        Parameters

        Returns (obj: any) => R

          • (obj: any): R
          • Parameters

            • obj: any

            Returns R

Generated using TypeDoc