Updates the value of a specific key in an object using a callback function.
The type of the values in the object.
The object to update.
The key of the value to update.
The function to generate the new value. It receives the current value and the key as arguments.
The new value.
objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;//=> { a: 2, b: 2 } Copy
objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;//=> { a: 2, b: 2 }
Generated using TypeDoc
Updates the value of a specific key in an object using a callback function.