New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

decl

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decl

A class declaration module, that improves code structure and modularization.

latest
Source
npmnpm
Version
0.2.3
Version published
Weekly downloads
12
-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

NPM

build status

Install

$ npm install decl

How to use

var cls = require('decl')({
    extend: ParentCls,

    constructor: function MyClass(arg1, arg2) {
        this.super('constructor', arg1, arg2);
    },

    method1: function() {
        //
    }
});

Class Statics

For defining static members on a class, simply pass a hash to the statics configuration key. These properties can then be accessed on class level. The this keyword resolves to the class within static members.

var cls = require('decl')({
    statics: function() {
        NAME: 'my/class',

        getName: function() {
            return this.NAME;
        }
    }
});

cls.getName() === 'my/class';
typeof (new cls).NAME === 'undefined';

ToDos

  • Improve the documentation
  • Add support for mixins/traits
  • Add support for inheritence of static members (static super?)

Keywords

oop

FAQs

Package last updated on 13 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts