You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
405 B

function InheritMultiple(bases = []) {
class Bases {
constructor() {
bases.forEach((base) => Object.assign(this, new base()));
}
}
bases.forEach((base) => {
Object.getOwnPropertyNames(base.prototype)
.filter((prop) => prop != "constructor")
.forEach((prop) => (Bases.prototype[prop] = base.prototype[prop]));
});
return Bases;
}
module.exports = InheritMultiple;