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

es6class

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6class

ES6 Command Line Class Generator

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

es6class

ES6 Command Line Class Generator

Installation

  $ npm install -g es6class

Usage

es6class allows you to generate EcmaScript 6 class files really fast with the command line.

  $ es6class file.js MyClass 

This will generate a JavaScript ES6 file called file.js with the following code.

class MyClass {
    
    constructor(options) {

    }

}

Class Inheritance

To implement class inheritance, use -e option

  $ es6class file.js MyClass -e ParentClass

Will generate

class MyClass extends ParentClass { ... }

Methods

You can specify methods to implement with -m, each method separated by a space.

  $ es6class fileName.js ClassName -m doSomething doSomethingElse

Will output the following:

class ClassName {
    
    constructor(options) {

    }

    doSomething() {

    }

    doSomethingElse() {

    }

}

Accessors properties and static methods

ES6 Allows you to create accessors properties get and set and also static methods. Create them by prefixing your method name with get. set. or .static

  $ es6class fileName.js ClassName -m static.doSomething get.name set.name

Output

class ClassName {
    
    constructor(options) {

    }

    static doSomething() {

    }

    get name() {

    }

    set name() {

    }

}

Run Tests

  $ npm test

NOTE: This is my first NPM published module and CLI Tool. Feedback and Issues will be really appreciated ! Thanks.

License: MIT

Author: Dorian Camilleri

FAQs

Package last updated on 30 May 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