(target, ...sources)
| 419 | */ |
| 420 | // eslint-disable-next-line |
| 421 | static defaults(target, ...sources): {} { |
| 422 | |
| 423 | sources.forEach(source => { |
| 424 | for (const key in source) { |
| 425 | if (!source.hasOwnProperty(key)) return; |
| 426 | if (target[key] === null || target[key] === undefined) { |
| 427 | target[key] = source[key]; |
| 428 | } else if (typeof source[key] === 'object' && typeof target[key] === 'object') { |
| 429 | // property is an object, recursively add it's field over... #1373 |
| 430 | Utils.defaults(target[key], source[key]); |
| 431 | } |
| 432 | } |
| 433 | }); |
| 434 | |
| 435 | return target; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Compare two objects for equality (shallow comparison). |
no outgoing calls
no test coverage detected