Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-to-html

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-to-html - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

30

lib/ansi_to_html.js

@@ -232,4 +232,6 @@ var Filter, STYLES, defaults, extend, toHexString, _i, _results,

Filter.prototype.tokenize = function(text, callback) {
var ansiMess, length, newline, realText, remove, removeXterm256, tokens, _results1,
var ansiHandler, ansiMatch, ansiMess, handler, i, length, newline, process, realText, remove, removeXterm256, tokens, _j, _len, _results1,
_this = this;
ansiMatch = false;
ansiHandler = 3;
remove = function(m) {

@@ -252,2 +254,3 @@ return '';

var code, _j, _len;
ansiMatch = true;
if (g1.trim().length === 0) {

@@ -288,12 +291,21 @@ g1 = '0';

];
process = function(handler, i) {
var matches;
if (i > ansiHandler && ansiMatch) {
return;
} else {
ansiMatch = false;
}
matches = text.match(handler.pattern);
text = text.replace(handler.pattern, handler.sub);
if (!(matches != null)) {
}
};
_results1 = [];
while ((length = text.length) > 0) {
tokens.forEach(function(handler) {
var matches;
matches = text.match(handler.pattern);
text = text.replace(handler.pattern, handler.sub);
if (!(matches != null)) {
}
});
for (i = _j = 0, _len = tokens.length; _j < _len; i = ++_j) {
handler = tokens[i];
process(handler, i);
}
if (text.length === length) {

@@ -300,0 +312,0 @@ break;

{
"name": "ansi-to-html",
"version": "0.1.0",
"version": "0.1.1",
"description": "Convert ansi escaped text streams to html.",

@@ -5,0 +5,0 @@ "main": "lib/ansi_to_html.js",

@@ -136,3 +136,3 @@ var Filter, expect, test;

});
return it('renders newlines when the newline option is true', function(done) {
it('renders newlines when the newline option is true', function(done) {
var f, result, text;

@@ -147,2 +147,10 @@ text = 'test\ntest\n';

});
return it('renders two escape sequences in sequence', function(done) {
var f, result, text;
text = 'months remaining\x1b[1;31mtimes\x1b[m\x1b[1;32mmultiplied by\x1b[m $10';
result = 'months remaining<b><span style="color:#A00">times</span></b><b><span style="color:#0A0">multiplied by</span></b> $10';
f = new Filter();
expect(f.toHtml(text)).to.equal(result);
return done();
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc