node-deep-extend icon indicating copy to clipboard operation
node-deep-extend copied to clipboard

extending of "old" javascript classes is broken | bug

Open seeden opened this issue 9 years ago • 3 comments

When I try

function BearerStrategy() {
}

BearerStrategy.prototype.authenticate = function () {
};

const extended = deepExtend({}, { strategies: [
  new BearerStrategy(),
] });

extended.strategies.forEach((s) => {
  console.log('extended', s.authenticate);
});

const s = new BearerStrategy();
console.log('original', s.authenticate);

The output will be:

extended undefined
original [Function]

which is totally wrong

seeden avatar Sep 22 '16 16:09 seeden

is this repo dead ?

seeden avatar Oct 02 '16 14:10 seeden

@seeden this lib isn't supposed to be used to clone some class instances (if it's not Date, RegExp, Buffer or Array).

P.S. Sorry about delay.

unclechu avatar Oct 02 '16 16:10 unclechu

@seeden Actually I'm going to implement custom cloning strategies in new major version, but can't say when I do it.

unclechu avatar Oct 02 '16 16:10 unclechu