Comparing version 0.3.5 to 0.3.6
@@ -11,3 +11,3 @@ | ||
(function() { | ||
var _, args, bg, bgrd, bgrdColors, c, ci, colorStream, colorize, colors, config, dimText, expand, fatText, fs, funkyBgrd, funkyText, j, k, len, len1, len2, len3, log, m, matchr, matchrConfig, noon, o, path, pattern, patterns, ref, ref1, ref2, ref3, regexes, sds, stream, syntaxFile, text, textColors, | ||
var _, amap, ansi, args, bg, bgrd, bgrdColors, c, ci, colorStream, colorize, colors, config, dimText, expand, fatText, fs, funkyBgrd, funkyText, j, k, len, len1, len2, len3, log, m, matchr, matchrConfig, noon, o, path, pattern, patterns, ref, ref1, ref2, ref3, regexes, sds, stream, syntaxFile, 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; }; | ||
@@ -84,15 +84,43 @@ | ||
args = require('karg')("\ncolorcat\n\n file . ? the file to display or stdin . *\n" + textColors + "\n fat . ? " + '▲▲ fat'.bold.white + " . = false\n dim . = false\n ? |" + ' ▲▲ dim'.dim.white + " \n" + bgrdColors + "\n pattern . ? colorize with pattern\n patternFile . ? colorize with patterns in file . - P\n \nversion " + (require(__dirname + "/../package.json").version)); | ||
args = require('karg')("\ncolorcat\n\n file . ? the file to display or stdin . *\n" + textColors + "\n fat . ? " + '▲▲ fat'.bold.white + " . = false\n dim . = false\n ? |" + ' ▲▲ dim'.dim.white + " \n" + bgrdColors + "\n pattern . ? colorize with pattern\n patternFile . ? colorize with patterns in file . - P\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)); | ||
/* | ||
00000000 0000000 000000000 000000000 00000000 00000000 000 000 | ||
000 000 000 000 000 000 000 000 000 0000 000 | ||
00000000 000000000 000 000 0000000 0000000 000 0 000 | ||
000 000 000 000 000 000 000 000 000 0000 | ||
000 000 000 000 000 00000000 000 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 | ||
*/ | ||
ansi = null; | ||
amap = null; | ||
if (args.ansi256) { | ||
ansi = require('./colors'); | ||
amap = { | ||
red: [ansi.r2, ansi.r4, ansi.r7], | ||
green: [ansi.g2, ansi.g4, ansi.g7], | ||
blue: [ansi.b2, ansi.b6, ansi.b7], | ||
yellow: [ansi.y2, ansi.y5, ansi.y6], | ||
magenta: [ansi.m1, ansi.m2, ansi.m4], | ||
cyan: [ansi.c1, ansi.c2, ansi.c4], | ||
black: [ansi.w1, ansi.w1, ansi.w2], | ||
gray: [ansi.w2, ansi.w4, ansi.w6], | ||
white: [ansi.w6, ansi.w7, ansi.w8] | ||
}; | ||
} | ||
/* | ||
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(names, str) { | ||
var len2, m, n, spl; | ||
var i, len2, len3, m, n, o, rev, spl; | ||
spl = names.split('.'); | ||
@@ -102,7 +130,28 @@ if (_.last(spl).substr(0, 2) === "s:") { | ||
} | ||
for (m = 0, len2 = spl.length; m < len2; m++) { | ||
n = spl[m]; | ||
if (colors[n] != null) { | ||
str = colors[n](str); | ||
if (args.ansi256) { | ||
i = 1; | ||
if (indexOf.call(spl, 'dim') >= 0) { | ||
i = 0; | ||
} | ||
if (indexOf.call(spl, 'bold') >= 0) { | ||
i = 2; | ||
} | ||
rev = _.reverse(spl); | ||
for (m = 0, len2 = rev.length; m < len2; m++) { | ||
n = rev[m]; | ||
if (amap[n] != null) { | ||
str = amap[n][i] + str; | ||
} | ||
} | ||
if (indexOf.call(spl, 'bold') >= 0) { | ||
str = ansi.bold + str; | ||
} | ||
str += ansi.reset; | ||
} else { | ||
for (o = 0, len3 = spl.length; o < len3; o++) { | ||
n = spl[o]; | ||
if (colors[n] != null) { | ||
str = colors[n](str); | ||
} | ||
} | ||
} | ||
@@ -112,2 +161,11 @@ return str; | ||
/* | ||
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 = []; | ||
@@ -150,2 +208,11 @@ | ||
/* | ||
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 | ||
*/ | ||
if (args.file != null) { | ||
@@ -196,3 +263,3 @@ syntaxFile = path.join(__dirname, '..', 'syntax', path.extname(args.file).substr(1) + '.noon'); | ||
clrzd = d.match; | ||
ref3 = d.stack; | ||
ref3 = d.stack.reverse(); | ||
for (o = 0, len2 = ref3.length; o < len2; o++) { | ||
@@ -279,3 +346,3 @@ sv = ref3[o]; | ||
} | ||
return process.stdout.write(colorLines.join('\n')); | ||
return log(colorLines.join('\n')); | ||
}); | ||
@@ -282,0 +349,0 @@ }; |
{ | ||
"name": "colorcat", | ||
"description": "loves colors", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"repository": { | ||
@@ -19,7 +19,8 @@ "type": "git", | ||
"dependencies": { | ||
"ansi-256-colors": "^1.1.0", | ||
"colors": "^1.1.2", | ||
"karg": ">=0.1.34", | ||
"lodash": "^4.0.0", | ||
"noon": ">=0.8.2" | ||
"karg": ">=0.2.1", | ||
"lodash": "^4.0.1", | ||
"noon": ">=0.8.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25843
13
726
5
6
+ Addedansi-256-colors@^1.1.0
+ Addedansi-256-colors@1.1.0(transitive)
Updatedkarg@>=0.2.1
Updatedlodash@^4.0.1
Updatednoon@>=0.8.3