Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/pathSetBy

Index

References

Functions

References

Renames and re-exports pathSetBy

Functions

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Type parameters

    • K: string | number | symbol

    • O: Record<any, any>

    • R

    Parameters

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

    Returns ReplaceType<O, K, R>

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Type parameters

    • K: string | number | symbol

    • V

    • R

    Parameters

    Returns <O>(obj: O) => ReplaceType<O, K, R>

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Type parameters

    • K: string | number | symbol

    Parameters

    • path: [K]

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

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Type parameters

    • O

    Parameters

    Returns O

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Parameters

    Returns <O>(obj: O) => O

      • <O>(obj: O): O
      • Type parameters

        • O

        Parameters

        • obj: O

        Returns O

  • Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

    Note: If property in the object is equal to value by reference then function just returns object without changes

    example
     pathSetBy(['a', 'b'], x => x+1, {a: { b:1 }}) //=> { a: { b: 2 } }
    

    Parameters

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

      • Type parameters

        • O

        Parameters

        Returns O

      • Parameters

        Returns <O>(obj: O) => O

          • <O>(obj: O): O
          • Type parameters

            • O

            Parameters

            • obj: O

            Returns O

Generated using TypeDoc