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

colorcat

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorcat - npm Package Compare versions

Comparing version 1.0.9 to 1.2.0

164

js/colorcat.js

@@ -1,41 +0,71 @@

/*
0000000 0000000 000 0000000 00000000 0000000 0000000 000000000
000 000 000 000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 000 000000000 000
000 000 000 000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 0000000 000 000 000
*/
(function() {
var _, amap, ansi, args, bg, bgrd, bgrdColors, c, ci, colorStream, colorize, colors, dimText, error, expand, fatText, file, fs, funkyBgrd, funkyText, j, k, len, len1, len2, len3, len4, log, m, matchr, noon, o, p, path, patternFunc, ref, ref1, ref2, ref3, ref4, regexes, stream, text, textColors,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
/*
0000000 0000000 000 0000000 00000000 0000000 0000000 000000000
000 000 000 000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 000 000000000 000
000 000 000 000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 0000000 000 000 000
*/
/*
0000000 000 000 0000000 000
000 000 0000 000 000 000
000000000 000 0 000 0000000 000
000 000 000 0000 000 000
000 000 000 000 0000000 000
*/
/*
0000000 000000000 00000000 00000000 0000000 00 00
000 000 000 000 000 000 000 000 000
0000000 000 0000000 0000000 000000000 000000000
000 000 000 000 000 000 000 000 0 000
0000000 000 000 000 00000000 000 000 000 000
*/
/*
0000000 0000000 000 0000000 00000000 000 0000000 00000000
000 000 000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 000 000 0000000
000 000 000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 000 0000000 00000000
*/
/*
00000000 000 000 000 000 000 000 000 000
000 000 000 0000 000 000 000 000 000
000000 000 000 000 0 000 0000000 00000
000 000 000 000 0000 000 000 000
000 0000000 000 000 000 000 000
*/
/*
00000000 0000000 000000000 000000000 00000000 00000000 000 000 0000000
000 000 000 000 000 000 000 000 000 0000 000 000
00000000 000000000 000 000 0000000 0000000 000 0 000 0000000
000 000 000 000 000 000 000 000 000 0000 000
000 000 000 000 000 00000000 000 000 000 000 0000000
*/
/*
00000000 000 000 00000000 0000000 000 000 0000000
000 000 000 000 000 000 000 0000 000 000 000
0000000 00000 00000000 000000000 000 0 000 000 000
000 000 000 000 000 000 000 0000 000 000
00000000 000 000 000 000 000 000 000 0000000
*/
/*
0000000 00000000 0000000 0000000
000 000 000 000 000 000
000000000 0000000 000 0000 0000000
000 000 000 000 000 000 000
000 000 000 000 0000000 0000000
*/
var _, amap, ansi, args, bg, bgrd, bgrdColors, c, ci, colorStream, colorize, colors, dimText, error, expand, fatText, file, fs, funkyBgrd, funkyText, j, k, len, len1, len2, len3, len4, log, m, matchr, noon, o, p, patternFunc, ref, ref1, ref2, ref3, ref4, regexes, slash, stream, text, textColors,
indexOf = [].indexOf;
fs = require('fs');
({colors, slash, noon, fs, _} = require('kxk'));
path = require('path');
colors = require('colors');
noon = require('noon');
matchr = require('./matchr');
_ = require('lodash');
log = console.log;
error = function(err) {
return process.stderr.write("[ERROR] ".yellow + (err + "\n").red);
return process.stderr.write("[ERROR] ".yellow + `${err}\n`.red);
};
/*
0000000 00000000 0000000 0000000
000 000 000 000 000 000
000000000 0000000 000 0000 0000000
000 000 000 000 000 000 000
000 000 000 000 0000000 0000000
*/
text = {

@@ -58,3 +88,3 @@ red: 'r',

c = ref[j];
textColors += " " + c + " . = false . - " + text[c] + " . ? " + (colors[c].bold('██')) + (colors[c]('██')) + (colors[c].dim('██')) + " " + (colors[c](c)) + "\n";
textColors += ` ${c} . = false . - ${text[c]} . ? ${colors[c].bold('██')}${colors[c]('██')}${colors[c].dim('██')} ${colors[c](c)}\n`;
}

@@ -83,16 +113,7 @@

}
bgrdColors += " " + c + " . = false . - " + bgrd[c] + " . ? " + (colors.reset(colors[bg](ci))) + "\n";
bgrdColors += ` ${c} . = false . - ${bgrd[c]} . ? ${colors.reset(colors[bg](ci))}\n`;
}
args = require('karg')("\ncolorcat\n\n file . ? the file(s) to display or stdin . **\n" + textColors + "\n fat . ? " + '▲▲ fat'.bold.white + " . = false\n dim . = false\n ? |" + ' ▲▲ dim'.dim.white + " \n" + bgrdColors + "\n ext . ? use syntax highlighting for *.ext\n pattern . ? colorize with pattern\n patternFile . ? colorize with patterns in file . - P\n skipEmpty . ? skip empty lines . = false\n lineNumbers . ? prepend output with line numbers . = false\n ansi256 . ? use 256 colors ansi codes . = false\n \nansi256 \n ∘ use " + 'ansi-256-colors'.gray.bold + " instead of " + 'colors'.gray.bold + " module\n ∘ colors don't get stripped when piping\n \nversion " + (require(__dirname + "/../package.json").version));
args = require('karg')(`\ncolorcat\n\n file . ? the file(s) to display or stdin . **\n${textColors}\n fat . ? ${'▲▲ fat'.bold.white} . = false\n dim . = false\n ? |${' ▲▲ dim'.dim.white} \n${bgrdColors}\n ext . ? use syntax highlighting for *.ext\n pattern . ? colorize with pattern\n patternFile . ? colorize with patterns in file . - P\n skipEmpty . ? skip empty lines . = false\n lineNumbers . ? prepend output with line numbers . = false\n ansi256 . ? use 256 colors ansi codes . = true\n \nansi256 \n ∘ use ${'ansi-256-colors'.gray.bold} instead of ${'colors'.gray.bold} module\n ∘ colors don't get stripped when piping\n \nversion ${(require(`${__dirname}/../package.json`).version)}`);
/*
0000000 000 000 0000000 000
000 000 0000 000 000 000
000000000 000 0 000 0000000 000
000 000 000 0000 000 000
000 000 000 000 0000000 000
*/
ansi = require('./colors');

@@ -125,11 +146,2 @@

/*
0000000 0000000 000 0000000 00000000 000 0000000 00000000
000 000 000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 000 000 0000000
000 000 000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 000 0000000 00000000
*/
colorize = function(str, stack) {

@@ -187,11 +199,2 @@ var err, i, len2, len3, len4, m, n, o, p, s, spl;

/*
00000000 000 000 00000000 0000000 000 000 0000000
000 000 000 000 000 000 000 0000 000 000 000
0000000 00000 00000000 000000000 000 0 000 000 000
000 000 000 000 000 000 000 0000 000 000
00000000 000 000 000 000 000 000 000 0000000
*/
regexes = [];

@@ -235,11 +238,2 @@

/*
00000000 000 000 000 000 000 000 000 000
000 000 000 0000 000 000 000 000 000
000000 000 000 000 0 000 0000000 00000
000 000 000 000 0000 000 000 000
000 0000000 000 000 000 000 000
*/
funkyText = function(s) {

@@ -285,11 +279,2 @@ return s;

/*
00000000 0000000 000000000 000000000 00000000 00000000 000 000 0000000
000 000 000 000 000 000 000 000 000 0000 000 000
00000000 000000000 000 000 0000000 0000000 000 0 000 0000000
000 000 000 000 000 000 000 000 000 0000 000
000 000 000 000 000 00000000 000 000 000 000 0000000
*/
patternFunc = function(file) {

@@ -307,5 +292,5 @@ var loadSyntax, matchrConfig, pattern, patterns;

} else if (args.ext != null) {
patterns = loadSyntax(path.join(__dirname, '..', 'syntax', args.ext + '.noon'));
patterns = loadSyntax(slash.join(__dirname, '..', 'syntax', args.ext + '.noon'));
} else if (file != null) {
patterns = loadSyntax(path.join(__dirname, '..', 'syntax', path.extname(file).substr(1) + '.noon'));
patterns = loadSyntax(slash.join(__dirname, '..', 'syntax', slash.ext(file) + '.noon'));
}

@@ -324,3 +309,3 @@ if (patterns == null) {

if (diss.length) {
for (di = p = ref4 = diss.length - 1; ref4 <= 0 ? p <= 0 : p >= 0; di = ref4 <= 0 ? ++p : --p) {
for (di = p = ref4 = diss.length - 1; (ref4 <= 0 ? p <= 0 : p >= 0); di = ref4 <= 0 ? ++p : --p) {
d = diss[di];

@@ -336,11 +321,2 @@ clrzd = colorize(d.match, d.stack.reverse());

/*
0000000 000000000 00000000 00000000 0000000 00 00
000 000 000 000 000 000 000 000 000
0000000 000 0000000 0000000 000000000 000000000
000 000 000 000 000 000 000 000 0 000
0000000 000 000 000 00000000 000 000 000 000
*/
colorStream = function(stream, pattern) {

@@ -367,3 +343,3 @@ var lineno;

lineno += 1;
return _.padEnd("" + lineno, 6).gray.dim + l;
return _.padEnd(`${lineno}`, 6).gray.dim + l;
});

@@ -375,3 +351,2 @@ }

/*

@@ -383,4 +358,3 @@ 0000000 0000000 000000000 000 00000000 000 000 00000000

0000000 000 000 000 000 000 000 0000000 00000000
*/
*/
if (args.file.length) {

@@ -394,3 +368,3 @@ ref4 = args.file;

stream.on('error', function(err) {
return error((" can't read file '" + file + "': ") + String(err).magenta);
return error(` can't read file '${file}': ` + String(err).magenta);
});

@@ -397,0 +371,0 @@ colorStream(stream, patternFunc(file));

@@ -1,11 +0,9 @@

/*
0000000 0000000 000 0000000 00000000 0000000
000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 0000000
000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 0000000
*/
(function() {
/*
0000000 0000000 000 0000000 00000000 0000000
000 000 000 000 000 000 000 000 000
000 000 000 000 000 000 0000000 0000000
000 000 000 000 000 000 000 000 000
0000000 0000000 0000000 0000000 000 000 0000000
*/
var B, B1, B2, B3, B4, B5, B6, B7, B8, BG_COLORS, C, C1, C2, C3, C4, C5, C6, C7, C8, FG_COLORS, G, G1, G2, G3, G4, G5, G6, G7, G8, M, M1, M2, M3, M4, M5, M6, M7, M8, R, R1, R2, R3, R4, R5, R6, R7, R8, W, W1, W2, W3, W4, W5, W6, W7, W8, Y, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, b, b1, b2, b3, b4, b5, b6, b7, b8, bg, bi, bn, bold, c, c1, c2, c3, c4, c5, c6, c7, c8, colors, fg, g, g1, g2, g3, g4, g5, g6, g7, g8, i, j, k, l, len, len1, log, m, m1, m2, m3, m4, m5, m6, m7, m8, n, r, r1, r2, r3, r4, r5, r6, r7, r8, reset, w, w1, w2, w3, w4, w5, w6, w7, w8, y, y1, y2, y3, y4, y5, y6, y7, y8;

@@ -17,97 +15,55 @@

r = function(i) {
if (i == null) {
i = 4;
}
r = function(i = 4) {
return (i < 6) && colors.fg.getRgb(i, 0, 0) || colors.fg.getRgb(5, i - 5, i - 5);
};
R = function(i) {
if (i == null) {
i = 4;
}
R = function(i = 4) {
return (i < 6) && colors.bg.getRgb(i, 0, 0) || colors.bg.getRgb(5, i - 5, i - 5);
};
g = function(i) {
if (i == null) {
i = 4;
}
g = function(i = 4) {
return (i < 6) && colors.fg.getRgb(0, i, 0) || colors.fg.getRgb(i - 5, 5, i - 5);
};
G = function(i) {
if (i == null) {
i = 4;
}
G = function(i = 4) {
return (i < 6) && colors.bg.getRgb(0, i, 0) || colors.bg.getRgb(i - 5, 5, i - 5);
};
b = function(i) {
if (i == null) {
i = 4;
}
b = function(i = 4) {
return (i < 6) && colors.fg.getRgb(0, 0, i) || colors.fg.getRgb(i - 5, i - 5, 5);
};
B = function(i) {
if (i == null) {
i = 4;
}
B = function(i = 4) {
return (i < 6) && colors.bg.getRgb(0, 0, i) || colors.bg.getRgb(i - 5, i - 5, 5);
};
y = function(i) {
if (i == null) {
i = 4;
}
y = function(i = 4) {
return (i < 6) && colors.fg.getRgb(i, i, 0) || colors.fg.getRgb(5, 5, i - 5);
};
Y = function(i) {
if (i == null) {
i = 4;
}
Y = function(i = 4) {
return (i < 6) && colors.bg.getRgb(i, i, 0) || colors.bg.getRgb(5, 5, i - 5);
};
m = function(i) {
if (i == null) {
i = 4;
}
m = function(i = 4) {
return (i < 6) && colors.fg.getRgb(i, 0, i) || colors.fg.getRgb(5, i - 5, 5);
};
M = function(i) {
if (i == null) {
i = 4;
}
M = function(i = 4) {
return (i < 6) && colors.bg.getRgb(i, 0, i) || colors.bg.getRgb(5, i - 5, 5);
};
c = function(i) {
if (i == null) {
i = 4;
}
c = function(i = 4) {
return (i < 6) && colors.fg.getRgb(0, i, i) || colors.fg.getRgb(i - 5, 5, 5);
};
C = function(i) {
if (i == null) {
i = 4;
}
C = function(i = 4) {
return (i < 6) && colors.bg.getRgb(0, i, i) || colors.bg.getRgb(i - 5, 5, 5);
};
w = function(i) {
if (i == null) {
i = 4;
}
w = function(i = 4) {
return colors.fg.grayscale[i];
};
W = function(i) {
if (i == null) {
i = 4;
}
W = function(i = 4) {
return colors.bg.grayscale[i];

@@ -381,3 +337,3 @@ };

s += eval(bg.toLowerCase() + bi) + bold;
s += ((bg.toLowerCase() + bi) + " " + (bg + bi) + " ") + reset + eval(bn);
s += `${bg.toLowerCase() + bi} ${bg + bi} ` + reset + eval(bn);
for (q = 0, len3 = FG_COLORS.length; q < len3; q++) {

@@ -394,2 +350,5 @@ fg = FG_COLORS[q];

// module.exports.show()
}).call(this);
{
"name": "colorcat",
"description": "loves colors",
"version": "1.0.9",
"version": "1.2.0",
"repository": {

@@ -20,7 +20,4 @@ "type": "git",

"ansi-256-colors": "^1.1.0",
"colors": "^1.1.2",
"karg": "^1.0.10",
"lodash": "^4.17.4",
"noon": "^1.0.14"
"kxk": "^0.40.0"
}
}
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