unclechu / node-deep-extend

Recursive extend module
MIT License
202 stars 53 forks source link

extending of "old" javascript classes is broken | bug #30

Open seeden opened 7 years ago

seeden commented 7 years ago

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 commented 7 years ago

is this repo dead ?

unclechu commented 7 years ago

@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 commented 7 years ago

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