12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 'use strict'
- module.exports = merge
- var hasOwnProperty = Object.prototype.hasOwnProperty
- function merge(dest, src, redefine) {
- if (!dest) {
- throw new TypeError('argument dest is required')
- }
- if (!src) {
- throw new TypeError('argument src is required')
- }
- if (redefine === undefined) {
-
- redefine = true
- }
- Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
- if (!redefine && hasOwnProperty.call(dest, name)) {
-
- return
- }
-
- var descriptor = Object.getOwnPropertyDescriptor(src, name)
- Object.defineProperty(dest, name, descriptor)
- })
- return dest
- }
|