0.2.4 • Published 10 years ago

es6like-class v0.2.4

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

es6like-class NPM version Build Status Coverage

Write es6 like classes in es5 with a few more features

Cover some limitations to the current implementation of classes in es6:

  • define properties
  • use traits

Use

var newClass = require('es6like-class').newClass;

var A = newClass({
    constructor: function A(value) {
        this.initialized = value;
    }
});

var B = newClass({
    extends: A,

    constructor: function B(value) {
        assert.strictEqual(this.constructor, B);
        this.bValue = value;
    }
});

Class special properties

  • abstract: set the class as abstract
  • constructor: this is the constructor of the class, like the constructor function in es6 classes
  • extends: extends a class from another or from an object
  • implements: light checks over expected implementations and warn eventually when something is missing
  • prototype
  • static: define static properties in the class
  • with: an array of traits, objects with properties
0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago