es6class
v1.0.0
Published
ES6 Command Line Class Generator
Downloads
4
Readme
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.