inherits-ex
Advanced tools
Comparing version 2.1.0-alpha.8 to 2.1.0-alpha.9
@@ -43,6 +43,14 @@ "use strict"; | ||
var _default = _clone; | ||
/** | ||
* Clone the constructor(static members) to dest | ||
* | ||
* **Note**: 'length', 'name', 'arguments', 'caller', 'prototype', 'super_', '__super__' members are not cloned. | ||
* @param {Function} dest | ||
* @param {Function} src | ||
* @param {Function} [filter] | ||
*/ | ||
exports.default = _default; | ||
function cloneCtor(dest, src, filter) { | ||
const filterFn = function (name, value) { | ||
if (['length', 'name', 'arguments', 'caller', 'prototype', 'super_', '__super__'].includes(name)) { | ||
if (['length', 'name', 'arguments', 'caller', 'prototype', 'super_', '__super__', '__proto__'].includes(name)) { | ||
return; | ||
@@ -57,5 +65,14 @@ } | ||
} | ||
/** | ||
* Clone the constructor's prototype to dest | ||
* | ||
* **Note**: 'Class', 'constructor' members are not cloned. | ||
* @param {Function} dest | ||
* @param {Function} src | ||
* @param {Function} [filter] | ||
*/ | ||
function clonePrototype(dest, src, filter) { | ||
const filterFn = function (name, value) { | ||
if (['Class', 'constructor'].includes(name)) { | ||
if (['Class', 'constructor', '__proto__'].includes(name)) { | ||
return; | ||
@@ -62,0 +79,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/snowyu/inherits-ex.js", | ||
"version": "2.1.0-alpha.8", | ||
"version": "2.1.0-alpha.9", | ||
"author": { | ||
@@ -8,0 +8,0 @@ "name": "Riceball LEE", |
@@ -48,3 +48,3 @@ const getOwnPropertyNames = Object.getOwnPropertyNames; | ||
const filterFn = function (name, value) { | ||
if (['length', 'name', 'arguments', 'caller', 'prototype', 'super_', '__super__'].includes(name)) {return} | ||
if (['length', 'name', 'arguments', 'caller', 'prototype', 'super_', '__super__', '__proto__'].includes(name)) {return} | ||
if (value !== undefined && filter) {value = filter(name, value)} | ||
@@ -66,3 +66,3 @@ return value; | ||
const filterFn = function (name, value) { | ||
if (['Class', 'constructor'].includes(name)) {return} | ||
if (['Class', 'constructor', '__proto__'].includes(name)) {return} | ||
if (value !== undefined && filter) {value = filter(name, value)} | ||
@@ -69,0 +69,0 @@ return value; |
258493
6834