GithubHelp home page GithubHelp logo

lambdalisue / deno-ansi-escape-code Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 0.0 27 KB

๐Ÿฆ• Utilities to trim and parse ANSI escape code

Home Page: https://jsr.io/@lambdalisue/ansi-escape-code

License: MIT License

TypeScript 100.00%
deno jsr ansi-escape-code

deno-ansi-escape-code's Introduction

ansi-escape-code

jsr denoland deno doc Test

Utilities to trim and parse ANSI escape sequence.

Usage

import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { trimAndParse } from "https://deno.land/x/ansi_escape_code/mod.ts";

const [trimmed, annotations] = trimAndParse(
  "\x1b[1mHe\x1b[30mll\x1b[31mo\x1b[m world",
);

assertEquals(trimmed, "Hello world");
assertEquals(annotations, [
  { offset: 0, raw: "\x1b[1m", csi: { sgr: { bold: true } } },
  { offset: 2, raw: "\x1b[30m", csi: { sgr: { foreground: 0 } } },
  { offset: 4, raw: "\x1b[31m", csi: { sgr: { foreground: 1 } } },
  { offset: 5, raw: "\x1b[m", csi: { sgr: { reset: true } } },
]);

License

The code follows MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.

deno-ansi-escape-code's People

Contributors

lambdalisue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deno-ansi-escape-code's Issues

csi does not label del, etc..

csi.ts currently does not provide anything for:

  • ins (\x1b[2~)
  • del (\x1b[3~)
  • home (\x1b[H)
  • page up (\x1b[5~)
  • page down (\x1b[6~)

would be nice to see it return something for these keys aside from csi: {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.