inherit-es6
v1.0.2
Published
Cleaner class structures for your es6 projects
Downloads
4
Maintainers
Readme
Inherit-es6
Get rid of big clunky classes. Outsource class methods into seperate files for the sake of cleanness.
Install
$ npm install inherit-es6
Getting started
Alternatively you can use this prepared example project.
Structure:
root
|-- index.js
|-- functions.js
Code:
// index.js
import inherit from "inherit-es6"
import * as _fns from "./functions"
export class Vector {
constructor(x) {
this.x = x || 0
this.y = y || 0
}
}
inherit(Vector, _fns)
// functions.js
export function clone() {
return new Vector(this.x, this.y)
}
export function invert() {
this.x = -this.x
this.y = -this.y
}