@nxmix/tokenize-ansi
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

tokenize-ansi

styled with prettier Build Status Coverage Status npm Greenkeeper badge

tokenize a string that includes ansi code.

Usage

install

npm install @nxmix/tokenize-ansi

example

import tokenize from '@nxmix/tokenize-ansi'

tokenize("\x1b1A");
// => [ ["up", 1] ], cursor moves up one line

tokenize("\x1b31m" + "a");
// => [ ["red"], ["text", "a"] ], red text

tokenize("\x1b38;2;123,45,67m" + "a");
// => [ ["moreColor", 2, 123, 45, 67], ["text", "a"] ], true-color text

tokenize("\x1b25h");
// => [ ["cursor-on"] ], show cursor

This project follows the all-contributors specification. Contributions of any kind are welcome!

/@nxmix/tokenize-ansi/

    Package Sidebar

    Install

    npm i @nxmix/tokenize-ansi

    Weekly Downloads

    191

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    23.7 kB

    Total Files

    18

    Last publish

    Collaborators

    • jacobbubu
    • nxdeploy
    • zhengle