This method is like `update` except that it accepts `customizer` which is invoked to produce the objects of `path`. If `customizer` returns `undefined` path creation is handled by the method instead. The `customizer` is invoked with three arguments: (nsValue, key, nsObject). **Note:** This method mutates `object`.
const object = {}
updateWith(object, '[0][1]', constant('a'), Object)
// => { '0': { '1': 'a' } }
Name | Type | Attribute | Description |
---|---|---|---|
object | The object to modify. | ||
path | The path of the property to set. | ||
updater | The function to produce the updated value. | ||
customizer | The function to customize assigned values. |
{ "comment": "/**\r\n * This method is like `update` except that it accepts `customizer` which is\r\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\r\n * path creation is handled by the method instead. The `customizer` is invoked\r\n * with three arguments: (nsValue, key, nsObject).\r\n *\r\n * **Note:** This method mutates `object`.\r\n *\r\n * @since 4.6.0\r\n * @category Object\r\n * @param {Object} object The object to modify.\r\n * @param {Array|string} path The path of the property to set.\r\n * @param {Function} updater The function to produce the updated value.\r\n * @param {Function} [customizer] The function to customize assigned values.\r\n * @returns {Object} Returns `object`.\r\n * @example\r\n *\r\n * const object = {}\r\n *\r\n * updateWith(object, '[0][1]', constant('a'), Object)\r\n * // => { '0': { '1': 'a' } }\r\n */", "meta": { "range": [ 881, 1095 ], "filename": "updateWith.js", "lineno": 25, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100011508", "name": "updateWith", "type": "FunctionDeclaration", "paramnames": [ "object", "path", "updater", "customizer" ] }, "vars": { "customizer": "updateWith~customizer" } }, "description": "This method is like `update` except that it accepts `customizer` which is\rinvoked to produce the objects of `path`. If `customizer` returns `undefined`\rpath creation is handled by the method instead. The `customizer` is invoked\rwith three arguments: (nsValue, key, nsObject).\r\r**Note:** This method mutates `object`.", "since": "4.6.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Object", "value": "Object" } ], "params": [ { "type": { "names": [ "Object" ] }, "description": "The object to modify.", "name": "object" }, { "type": { "names": [ "Array", "string" ] }, "description": "The path of the property to set.", "name": "path" }, { "type": { "names": [ "function" ] }, "description": "The function to produce the updated value.", "name": "updater" }, { "type": { "names": [ "function" ] }, "optional": true, "description": "The function to customize assigned values.", "name": "customizer" } ], "returns": [ { "type": { "names": [ "Object" ] }, "description": "Returns `object`." } ], "examples": [ "const object = {}\r\rupdateWith(object, '[0][1]', constant('a'), Object)\r// => { '0': { '1': 'a' } }" ], "name": "updateWith", "longname": "updateWith", "kind": "function", "scope": "global", "___id": "T000002R001044", "___s": true, "filepath": "updateWith.js" }