Naboo's Podracing Misadventure
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

This package has been deprecated

Author message:

use

es6like-class

0.2.4 • Public • Published

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

Keywords

install

npm i es6like-class

Downloadsweekly downloads

4

version

0.2.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability