How to use the ansicolor.parse function in ansicolor

To help you get started, we’ve selected a few ansicolor 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 raine / treis / lib / utils-browser.js View on Github external
msgs.forEach(m => {
    const parsed = ansi.parse(m)
    console.log(...parsed.asChromeConsoleLogArguments)
  })
}
github grafana / grafana / public / app / features / explore / LogMessageAnsi.tsx View on Github external
static getDerivedStateFromProps(props: Props, state: State) {
    if (props.value === state.prevValue) {
      return null;
    }

    const parsed = ansicolor.parse(props.value);

    return {
      chunks: parsed.spans.map(span => {
        return span.css
          ? {
              style: convertCSSToStyle(span.css),
              text: span.text,
            }
          : { text: span.text };
      }),
      prevValue: props.value,
    };
  }

ansicolor

A JavaScript ANSI color/style management. ANSI parsing. ANSI to CSS. Small, clean, no dependencies.

Unlicense
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis