Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/assoc

Index

References

Functions

References

Renames and re-exports assoc

Functions

  • assoc<K, V, O>(prop: K, val: V, obj: O): O & { [ k in string | number | symbol]: V }
  • assoc<K, V>(prop: K, val: V): <O>(obj: O) => O & { [ k in string | number | symbol]: V }
  • assoc<K>(prop: K): { <V, O>(val: V, obj: O): O & { [ k in string | number | symbol]: V }; <V>(val: V): <O>(obj: O) => O & { [ k in string | number | symbol]: V } }
  • Makes a shallow clone of an object, setting or overriding the specified property with the given value. All non-primitive properties are copied by reference.

    deprecated

    use object/propSet instead

    example
     assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
    

    Type parameters

    • K: string | number | symbol

    • V

    • O

    Parameters

    • prop: K

      The property name to set

    • val: V

      The new value

    • obj: O

      The object to clone

    Returns O & { [ k in string | number | symbol]: V }

    A new object equivalent to the original except for the changed property.

  • Makes a shallow clone of an object, setting or overriding the specified property with the given value. All non-primitive properties are copied by reference.

    deprecated

    use object/propSet instead

    example
     assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
    

    Type parameters

    • K: string | number | symbol

    • V

    Parameters

    • prop: K

      The property name to set

    • val: V

      The new value

    Returns <O>(obj: O) => O & { [ k in string | number | symbol]: V }

    A new object equivalent to the original except for the changed property.

      • <O>(obj: O): O & { [ k in string | number | symbol]: V }
      • Type parameters

        • O

        Parameters

        • obj: O

        Returns O & { [ k in string | number | symbol]: V }

  • Makes a shallow clone of an object, setting or overriding the specified property with the given value. All non-primitive properties are copied by reference.

    deprecated

    use object/propSet instead

    example
     assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
    

    Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

      The property name to set

    Returns { <V, O>(val: V, obj: O): O & { [ k in string | number | symbol]: V }; <V>(val: V): <O>(obj: O) => O & { [ k in string | number | symbol]: V } }

    A new object equivalent to the original except for the changed property.

      • <V, O>(val: V, obj: O): O & { [ k in string | number | symbol]: V }
      • <V>(val: V): <O>(obj: O) => O & { [ k in string | number | symbol]: V }
      • Type parameters

        • V

        • O

        Parameters

        • val: V
        • obj: O

        Returns O & { [ k in string | number | symbol]: V }

      • Type parameters

        • V

        Parameters

        • val: V

        Returns <O>(obj: O) => O & { [ k in string | number | symbol]: V }

          • <O>(obj: O): O & { [ k in string | number | symbol]: V }
          • Type parameters

            • O

            Parameters

            • obj: O

            Returns O & { [ k in string | number | symbol]: V }

Generated using TypeDoc