.update()
Updates the provided key's value with the provided callback.
Last updated
Updates the provided key's value with the provided callback.
Last updated
Also allows the use of dot notation:
And even a way to delete a key from the data:
When the callback parameter's value is not an object, the value that the update callback returns will be the value that will replace the old one, so it's optional to redefine its value inside the callback:
Parameter
Description
key
The target key
updateCallback
Function to call to update the data
Returns
Description
The updated data from the provided key's root