inherits-class

1.0.0 • Public • Published

inherits-class

This is es2015 library for inherits multiple "class's function".

Install

$ npm install inherits-class

JSDoc

inherits(...clss) ⇒ Object

inherits multipule "class's function"

Kind: global function
Returns: Object - inherited class

Param Type Description
...clss Object class or Object

Example

class FirstClass {
  first() {
    return 'first func';
  }
};
class SecondClass {
  second() {
    // For Example. Abstract this function.
    throw new Error('second is not implement!');
  }
};

let ThirdObj = {
  third: () => {
    return 'third func';
  }
}
class Base extends inherits(FirstClass, SecondClass, ThirdObj) {
  constructor() {
    super();
  }
  base() {
    return 'base func';
  }
}
let base = new Base();
base.first();  // 'first func'
base.second(); // throws error
base.third();  // 'third func'
base.base();   // 'base func'

Development

# watch
npm run watch
# build
npm run build
# test
npm run test

Contributing

  1. Please Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Package Sidebar

Install

npm i inherits-class

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nodhy