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
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
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
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(num1, num2) {
return num1 + num2;
}
};
Licensing
The code in this project is licensed under MIT license.