1.0.0 • Published 10 years ago
es6class v1.0.0
es6class
ES6 Command Line Class Generator
Installation
$ npm install -g es6classUsage
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 ParentClassWill 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 doSomethingElseWill 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.nameOutput
class ClassName {
constructor(options) {
}
static doSomething() {
}
get name() {
}
set name() {
}
}Run Tests
$ npm testNOTE: This is my first NPM published module and CLI Tool. Feedback and Issues will be really appreciated ! Thanks.
License: MIT
Author: Dorian Camilleri
1.0.0
10 years ago