(parentConfig, childConfig)
| 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) { |
no test coverage detected