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

11 months ago
  1. function InheritMultiple(bases = []) {
  2. class Bases {
  3. constructor() {
  4. bases.forEach((base) => Object.assign(this, new base()));
  5. }
  6. }
  7. bases.forEach((base) => {
  8. Object.getOwnPropertyNames(base.prototype)
  9. .filter((prop) => prop != "constructor")
  10. .forEach((prop) => (Bases.prototype[prop] = base.prototype[prop]));
  11. });
  12. return Bases;
  13. }
  14. module.exports = InheritMultiple;