UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

17 lines (16 loc) 554 B
import { updateWith } from "./updateWith.mjs"; //#region src/compat/object/update.ts /** * Updates the value at the specified path of the given object using an updater function. * If any part of the path does not exist, it will be created. * * @param obj - The object to modify. * @param path - The path of the property to update. * @param updater - The function to produce the updated value. * @returns The modified object. */ function update(obj, path, updater) { return updateWith(obj, path, updater, () => void 0); } //#endregion export { update };