commentizer
v1.0.17
Published
Add jsdoc style comments to functions and class methods
Downloads
22
Readme
Commentizer
Intro
Commentizer generates jsdoc style comments for javascript functions and class methods.
Install
npm install --save-dev commentizer
--- or globally
npm install -g commentizer
CLI
commentizer [filename ...]
Using glob to find files.
commentizer "src/**/*.js"
Only one file will have comments generated.
commentizer "src/my-file.js"
Examples
function declaration
Source File
function add(num1, num2) {
return num1 + num2;
}
module.exports = {
add: add
};
Generated file
/**
* add
* @param {} num1
* @param {} num2
* returns {}
*/
function add(num1, num2) {
return num1 + num2;
}
module.exports = {
add: add
};
function expression
Source File
const add = function(num1, num2) {
return num1 + num2;
}
module.exports = {
add: add
};
Generated file
/**
* add
* @param {} num1
* @param {} num2
* returns {}
*/
const add = function(num1, num2) {
return num1 + num2;
}
module.exports = {
add: add
};
arrow function expression
Source File
const add = (num1, num2) => {
return num1 + num2;
}
module.exports = {
add: add
};
Generated file
/**
* add
* @param {} num1
* @param {} num2
* returns {}
*/
const add = (num1, num2) => {
return num1 + num2;
}
module.exports = {
add: add
};
class method (ES2015)
Source File
export class TestClass {
add(num1, num2) {
return num1 + num2;
}
};
Generated file
export class TestClass {
/**
* add
* @param {} num1
* @param {} num2
* @returns {}
*/
add(num1, num2) {
return num1 + num2;
}
};
Licensing
The code in this project is licensed under MIT license.