MCPcopy
hub / github.com/sequelize/sequelize / defaults

Function defaults

lib/utils.js:576–598  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

574 * @private
575 */
576function 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}
599exports.defaults = defaults;
600
601/**

Callers

nothing calls this directly

Calls 1

getComplexKeysFunction · 0.85

Tested by

no test coverage detected