Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 469 Bytes

README.md

File metadata and controls

33 lines (26 loc) · 469 Bytes

ansi-parser

Parser for string that include ansi codes.

Install

npm i @cakecatz/ansi-parser

Usage

const { parseAnsi } = require("@cakecatz/ansi-parser");
const cells = parseAnsi("\u001b[31mhello\u001b[39m");

cells will be like this.

[
  {
    bg: 0, // COLOR_CODES.BLACK
    fg: 1, // COLOR_CODES.RED
    content: "hello",
    bold: false,
    dim: false,
    inverse: false,
    italic: false,
    underline: false
  }
];