💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## defaults + [link](./defaults "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L10879 "View in source.") + [npm](https://www.npmjs.com/package/lodash.defaults "See the npm package.") ``` _.defaults(object, [sources]) ``` 分配来源对象的可枚举属性到目标对象所有解析为 `undefined` 的属性上。 来源对象从左到右应用。 一旦设置了相同属性的值,后续的将被忽略掉。 **注意:** 这方法会改变源对象 ### 参数 1. object (Object) 目标对象 2. [sources] (...Object) 来源对象 ### 返回值 (Object) 返回对象 ### 示例 ``` _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => { 'user': 'barney', 'age': 36 } ```