js-groomer

1.0.0 • Public • Published

Usage:

Remove just a comment

const groomer = require('js-groomer');
const cleaned = groomer.handleFile(myFileInput, function(comment) {
    if (comment === '// REMOVEME')
        return groomer.RemoveOptions.REMOVE_COMMENT;
});

Remove a block of code after a comment

const groomer = require('js-groomer');
const cleaned = groomer.handleFile(myFileInput, function(comment) {
    if (comment === '// REMOVEME')
        return groomer.RemoveOptions.REMOVE_CODE;
});

Replace a comment

const groomer = require('js-groomer');
const cleaned = groomer.handleFile(myFileInput, function(comment) {
    if (comment === '// REMOVEME') {
        return {
            action: groomer.RemoveOptions.REMOVE_COMMENT,
            data: 'foobar'
        };
    }
});

Readme

Keywords

none

Package Sidebar

Install

npm i js-groomer

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • andrewstart