* Assigns own and inherited enumerable string and symbol keyed properties of source * objects to the destination object. * * https://lodash.com/docs/4.17.4#defaults * * **Note:** This method mutates `object`. * * @param {object} object The destination object. * @param {...object} [sources] T
(object, ...sources)
| 587 | * @private |
| 588 | */ |
| 589 | function defaults(object, ...sources) { |
| 590 | object = Object(object); |
| 591 | |
| 592 | sources.forEach(source => { |
| 593 | if (source) { |
| 594 | source = Object(source); |
| 595 | |
| 596 | getComplexKeys(source).forEach(key => { |
| 597 | const value = object[key]; |
| 598 | if ( |
| 599 | value === undefined || |
| 600 | _.eq(value, Object.prototype[key]) && |
| 601 | !Object.prototype.hasOwnProperty.call(object, key) |
| 602 | |
| 603 | ) { |
| 604 | object[key] = source[key]; |
| 605 | } |
| 606 | }); |
| 607 | } |
| 608 | }); |
| 609 | |
| 610 | return object; |
| 611 | } |
| 612 | exports.defaults = defaults; |
| 613 | |
| 614 | /** |
nothing calls this directly
no test coverage detected