Function objSet

  • Sets a value for a key in an object and returns the value.

    Type Parameters

    • V

      The type of the values in the object.

    Parameters

    • obj: Record<ObjectKey, V>

      The object in which to set the value.

    • key: ObjectKey

      The key for which to set the value.

    • value: V

      The value to set.

    Returns V

    The value that was set.

    Example

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

Generated using TypeDoc