Socket
Socket
Sign inDemoInstall

ansi-color-parse

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ansi-color-parse

# Usage ``` npm install ansi-color-parse


Version published
Maintainers
1
Install size
15.9 kB
Created

Readme

Source

ansi-color-parse

Usage

npm install ansi-color-parse

const {parseAnsi, ansi2html, parseHtml} = require('ansi-color-parse');

const str = "\u001b[34mHello\u001b[39m World\u001b[31m!\u001b[39m";

const parseList = parseAnsi(str);

console.log(parseList);
// [ { foreground: 'blue', text: 'Hello' },
//   { text: ' World' },
//   { foreground: 'red', text: '!' } ]

console.log(ansi2html(parseList));
// <span class="blue">Hello</span><span> World</span><span class="red">!</span>

console.log(parseHtml(str));
//<span class="blue">Hello</span><span> World</span><span class="red">!</span>

License

MIT

Copyright (c) 2018 蓝色的秋风

FAQs

Last updated on 21 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc