How to use the decomment.text function in decomment

To help you get started, we’ve selected a few decomment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electricimp / Builder / src / AstParser.js View on Github external
let matches, type, arg;
    const lines = source.match(LINES);

    for (let i = 0; i < lines.length - 1 /* last line is always empty */; i++) {
      const text = lines[i];

      if (matches = text.match(DIRECTIVE)) {
        const token = {_line: 1 + i};

        type = matches[1];
        arg = matches[2].trim();
        token.args = [];

        // remove single line comments from arg
        arg = decomment.text(arg);

        switch (type) {

          case 'include':
            // detect "once" flag
            if (/^once\b/.test(arg)) {
              token.args.push('once');
              arg = arg.substr(5).trim();
            }

            this._checkArgumentIsNonempty(type, arg, token._line);
            token.type = TOKENS.INCLUDE;
            token.args.push(arg);
            break;

          case 'set':
github stoikerty / dev-toolkit / src / packages / dev-toolkit / src / postinstall-prepare / copy-templates.js View on Github external
.then(data => {
        // Uncomment files as if they were plain text files (avoiding issues with jsx)
        outputFile(filePath, decomment.text(data));
      })
      .catch(err => {

decomment

Removes comments from JSON/JavaScript, CSS/HTML, CPP/H, etc.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis