How to use the colors-cli/safe.magenta function in colors-cli

To help you get started, we’ve selected a few colors-cli 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 alxolr / redosy / lib / redos-scanner.js View on Github external
const { Writable } = require('stream');
const esprima = require('esprima');
const fs = require('fs');
const safe = require('./safe-regexp');
const color = require('colors-cli/safe');

const error = color.red.bold;
const notice = color.magenta;
const warn = color.red;

class RedosScanner extends Writable {
  constructor() {
    super();
    this.issues = {};
  }

  _write(filePath, enc, next) {
    const instance = this;
    fs.readFile(filePath, 'utf8', handleFile);

    function handleFile(err, file) {
      try {
        esprima.tokenize(file, { loc: true, range: true, comment: true }, handleToken(instance, filePath));
      } catch (err) { } // eslint-disable-line