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.6.4 to 0.6.5

6

package.json
{
"name": "ansi-to-html",
"version": "0.6.4",
"version": "0.6.5",
"description": "Convert ansi escaped text streams to html.",

@@ -50,2 +50,6 @@ "main": "lib/ansi_to_html.js",

"email": "pnidem@gmail.com"
},
{
"name": "Paul Grime",
"email": "gitgrimbo@gmail.com"
}

@@ -52,0 +56,0 @@ ],

@@ -221,2 +221,37 @@ /* globals describe, it*/

it('drops ED code with 0 parameter', function (done) {
const text = '\x1b[Jhello';
const result = 'hello';
return test(text, result, done);
});
it('drops ED code with 1 parameter', function (done) {
const text = '\x1b[1Jhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 0 parameter', function (done) {
const text = '\x1b[;fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 1 parameter', function (done) {
const text = '\x1b[123;fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 2 parameter', function (done) {
const text = '\x1b[123;456fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops setusg0 sequence', function (done) {

@@ -223,0 +258,0 @@ const text = '\x1b[(Bhello';

@@ -6,2 +6,4 @@ /* globals describe, it*/

const EOL = require('os').EOL;
function getColorCmd(cmd) {

@@ -11,3 +13,4 @@ const cmds = {

linux: `CLICOLOR="1" ${cmd} | node lib/cli`,
win32: `${cmd} | node lib/cli`
// for win32 compatibility, make sure there is no space between the cmd and the pipe
win32: `${cmd}| node lib/cli`
};

@@ -18,6 +21,13 @@

function echo(str) {
if (process.platform === 'win32') {
return `echo ${str}`;
}
return `echo "${str}"`;
}
describe('cli', function () {
it('converts colors', function (done) {
const data = 'echo "what\033[0;31m what?"';
const result = 'what<span style=\"color:#A00\"> what?\n</span>';
const data = echo('what\033[0;31m what?');
const result = `what<span style="color:#A00"> what?${EOL}</span>`;

@@ -24,0 +34,0 @@ childProcess.exec(getColorCmd(data), {

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