How to use strip-ansi - 10 common examples

To help you get started, we’ve selected a few strip-ansi 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 MoOx / postcss-cssnext / docs / src / modules / playground / index.js View on Github external
function transformCSS() {
    const css = opts.from.value;

    opts.console.innerHTML = "";
    opts.messages.textContent = "";

    try {
      const result = transformer.process(css);
      opts.to.value = result.css.trim();
      const messages = result.warnings();
      if (messages.length) {
        opts.messages.textContent = `${bullet} ${stripColor(
          messages.map(message => message.toString())
        ).join("\n\n\n" + bullet + " ")}`;
      }
    } catch (e) {
      console.error(e);
      opts.to.value = "";
      opts.console.innerHTML =
        '<small class="cssnext-Playground-console-footer"><br><br>' +
        "If you think it's a bug, please " +
        '<a href="https://github.com/MoOx/postcss-cssnext/issues">' +
        "report it</a>." +
        "<br><small><em>cssnext v" +
        cssnextVersion +
        "</em></small></small>";
      // use createTextNode to escape html entities
      opts.console.insertBefore(
github zeit / next.js / packages / next / client / dev / error-overlay / hot-dev-client.js View on Github external
// Print warnings to the console.
  const formatted = formatWebpackMessages({
    warnings: warnings,
    errors: [],
  })

  if (typeof console !== 'undefined' &amp;&amp; typeof console.warn === 'function') {
    for (let i = 0; i &lt; formatted.warnings.length; i++) {
      if (i === 5) {
        console.warn(
          'There were more warnings in other files.\n' +
            'You can find a complete log in the terminal.'
        )
        break
      }
      console.warn(stripAnsi(formatted.warnings[i]))
    }
  }
}
github lnlfps / symph-joy / client / dev-error-overlay / hot-dev-client.js View on Github external
isFirstCompilation = false
  hasCompileErrors = true

  // "Massage" webpack messages.
  var formatted = formatWebpackMessages({
    errors: errors,
    warnings: []
  })

  // Only show the first error.
  ErrorOverlay.reportBuildError(formatted.errors[0])

  // Also log them to the console.
  if (typeof console !== 'undefined' &amp;&amp; typeof console.error === 'function') {
    for (var i = 0; i &lt; formatted.errors.length; i++) {
      console.error(stripAnsi(formatted.errors[i]))
    }
  }
}
github pgilad / leasot / tests / cli-spec.js View on Github external
cp.on('close', function (exitCode) {
        cb(exitCode, eol_1.split(strip_ansi_1["default"](chunks)));
    });
}
github ehmicky / gulp-execa / test / helpers / normalize.js View on Github external
export const normalizeMessage = function(message) {
  const messageA = stripAnsi(message)
  const messageB = REPLACEMENTS.reduce(replacePart, messageA)
  const messageC = messageB.trim()
  return messageC
}
github forcedotcom / salesforcedx-vscode / packages / salesforcedx-vscode-lwc / src / testSupport / testIndexer / jestUtils.ts View on Github external
export function sanitizeFailureMessage(failureMessage: string) {
  return stripAnsi(failureMessage);
}
github pgilad / leasot / tests / cli-spec.js View on Github external
testCli(['salesforce-apex.cls'], ['--associate-parser', '.cls,defaultParser'], function (exitCode, log) {
            should.exist(exitCode);
            should.exist(log);
            exitCode.should.equal(1);
            log.should.eql([
                '',
                'tests/fixtures/salesforce-apex.cls',
                '  line 4  TODO   Add detail',
                '  line 7  FIXME  do something with the file contents',
                '',
                ' ' + strip_ansi_1["default"](logSymbols.error) + ' 2 todos/fixmes found',
                '',
            ]);
            callback();
        });
    });
github pgilad / leasot / tests / cli-spec.js View on Github external
testCli(['no-todos.js'], null, function (exitCode, log) {
            should.exist(log);
            should.exist(exitCode);
            exitCode.should.equal(0);
            log.should.eql(['', '', ' ' + strip_ansi_1["default"](logSymbols.success) + ' No todos/fixmes found', '']);
            callback();
        });
    });
github pgilad / leasot / tests / cli-spec.js View on Github external
testCli(['file.unsupported'], [], function (exitCode, log) {
            should.exist(exitCode);
            should.exist(log);
            exitCode.should.equal(1);
            log.should.eql([strip_ansi_1["default"](logSymbols.error) + ' Filetype .unsupported is unsupported.', '']);
            callback();
        });
    });

strip-ansi

Strip ANSI escape codes from a string

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Popular strip-ansi functions