inherits-ex
Advanced tools
Comparing version 2.1.0-alpha.5 to 2.1.0-alpha.6
@@ -27,3 +27,3 @@ "use strict"; | ||
const source = arguments[i]; | ||
defineProperties(target, getOwnPropertyDescriptors(source)); | ||
if (source) defineProperties(target, getOwnPropertyDescriptors(source)); | ||
/* | ||
@@ -30,0 +30,0 @@ for (const key in source) { |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/snowyu/inherits-ex.js", | ||
"version": "2.1.0-alpha.5", | ||
"version": "2.1.0-alpha.6", | ||
"author": { | ||
@@ -8,0 +8,0 @@ "name": "Riceball LEE", |
@@ -22,3 +22,3 @@ const defineProperties = Object.defineProperties | ||
defineProperties(target, getOwnPropertyDescriptors(source)) | ||
if (source) defineProperties(target, getOwnPropertyDescriptors(source)) | ||
/* | ||
@@ -25,0 +25,0 @@ for (const key in source) { |
@@ -54,2 +54,11 @@ import assert from 'assert'; | ||
}); | ||
it('should only extend the exists source object', () => { | ||
const target = { a: 1 }; | ||
const source = Object.create(null, { | ||
b: { value: 2 }, | ||
c: { value: 3, enumerable: true } | ||
}); | ||
const result = _extend(target, source, null, undefined); | ||
assert.deepStrictEqual(result, { a: 1, c: 3 }); | ||
}); | ||
}); |
245762
6477