* 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)
| 574 | * @private |
| 575 | */ |
| 576 | function defaults(object, ...sources) { |
| 577 | object = Object(object); |
| 578 | |
| 579 | sources.forEach(source => { |
| 580 | if (source) { |
| 581 | source = Object(source); |
| 582 | |
| 583 | getComplexKeys(source).forEach(key => { |
| 584 | const value = object[key]; |
| 585 | if ( |
| 586 | value === undefined || |
| 587 | _.eq(value, Object.prototype[key]) && |
| 588 | !Object.prototype.hasOwnProperty.call(object, key) |
| 589 | |
| 590 | ) { |
| 591 | object[key] = source[key]; |
| 592 | } |
| 593 | }); |
| 594 | } |
| 595 | }); |
| 596 | |
| 597 | return object; |
| 598 | } |
| 599 | exports.defaults = defaults; |
| 600 | |
| 601 | /** |
nothing calls this directly
no test coverage detected