inherit-es6

1.0.2 • Public • Published

Inherit-es6 NPM Version

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
}

Package Sidebar

Install

npm i inherit-es6

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • maierfelix