MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / mergeConfigs

Function mergeConfigs

tests/test_code/js/moment/moment.js:372–399  ·  view source on GitHub ↗
(parentConfig, childConfig)

Source from the content-addressed store, hash-verified

370 }
371
372 function mergeConfigs(parentConfig, childConfig) {
373 var res = extend({}, parentConfig),
374 prop;
375 for (prop in childConfig) {
376 if (hasOwnProp(childConfig, prop)) {
377 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
378 res[prop] = {};
379 extend(res[prop], parentConfig[prop]);
380 extend(res[prop], childConfig[prop]);
381 } else if (childConfig[prop] != null) {
382 res[prop] = childConfig[prop];
383 } else {
384 delete res[prop];
385 }
386 }
387 }
388 for (prop in parentConfig) {
389 if (
390 hasOwnProp(parentConfig, prop) &&
391 !hasOwnProp(childConfig, prop) &&
392 isObject(parentConfig[prop])
393 ) {
394 // make sure changes to properties don't modify parent config
395 res[prop] = extend({}, res[prop]);
396 }
397 }
398 return res;
399 }
400
401 function Locale(config) {
402 if (config != null) {

Callers 2

defineLocaleFunction · 0.85
updateLocaleFunction · 0.85

Calls 3

extendFunction · 0.85
hasOwnPropFunction · 0.85
isObjectFunction · 0.85

Tested by

no test coverage detected