> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/object/assigninwith.md).

# \_.assignInWith

**语法：**

```javascript
_.assignInWith(object, sources, [customizer])
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L12670)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.assigninwith)

**描述：**

这个方法类似[`_.assignIn`](https://lodash.com/docs/4.17.10#assignIn)， 除了它接受一个`customizer`，被调用以产生所分配的值。 如果`customizer`返回`undefined`将会由分配处理方法代替。`customizer`会传入5个参数：*(objValue, srcValue, key, object, source)*。

**开始版本：**&#x34;.0.0

**别名：***\\*.extendWith\_

**参数：**

* `object (Object)`: 目标对象。
* `sources (...Object)`: 来源对象。
* `[customizer] (Function)`: 这个函数用来自定义分配的值。

**返回值：**

* `(Object)`: 返回 object。

**例子：**

```javascript
function customizer(objValue, srcValue) {
  return _.isUndefined(objValue) ? srcValue : objValue;
}

var defaults = _.partialRight(_.assignInWith, customizer);

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