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

kleur

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kleur - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

21

index.js

@@ -6,3 +6,2 @@ const { format } = require('util');

const RGX = /\x1b\[[0-9]+m/ig;
const toANSI = x => `\x1b[${x}m`;

@@ -15,7 +14,5 @@ function print() {

for (; i < arr.length; i++) {
tmp = CODES[arr[i]]; // [x1, x2, rgx]
if (out.indexOf(tmp[0]) !== 0 || out.slice(-tmp[1].length) !== tmp[1]) {
out = tmp[0] + out.replace(tmp[2], tmp[0]) + tmp[1];
}
isMulti && (out = out.replace(/(\r?\n)/g, `${tmp[1]}$1${tmp[0]}`));
tmp = CODES[arr[i]]; // { x1, x2, rgx }
out = tmp.beg + out.replace(tmp.rgx, tmp.beg) + tmp.end;
isMulti && (out = out.replace(/(\r?\n)/g, `${tmp.end}$1${tmp.beg}`));
}

@@ -27,5 +24,5 @@

function wrap(keys) {
let fn = (...args) => print.apply(fn, args);
Object.setPrototypeOf(fn, $);
fn.keys = keys;
let ctx = {};
let fn = Object.setPrototypeOf(print.bind(ctx), $);
ctx.keys = fn.keys = keys;
return fn;

@@ -35,3 +32,7 @@ }

for (let k in CODES) {
CODES[k] = CODES[k].map(toANSI).concat(new RegExp(`\\x1b\\[${CODES[k][1]}m`, 'g'));
CODES[k] = {
beg: `\x1b[${CODES[k][0]}m`,
end: `\x1b[${CODES[k][1]}m`,
rgx: new RegExp(`\\x1b\\[${CODES[k][1]}m`, 'g')
};
Object.defineProperty($, k, {

@@ -38,0 +39,0 @@ get() {

{
"name": "kleur",
"version": "1.0.0",
"version": "1.0.1",
"repository": "lukeed/kleur",

@@ -5,0 +5,0 @@ "description": "The fastest Node.js library for formatting terminal text with ANSI colors~!",

@@ -157,6 +157,6 @@ <div align="center">

```
ansi-colors: 1.172ms
chalk: 11.799ms
clorox: 0.922ms
kleur: 0.694ms
ansi-colors: 1.150ms
chalk: 8.440ms
clorox: 0.471ms
kleur: 0.611ms
```

@@ -168,18 +168,18 @@

# All Colors
ansi-colors x 60,235 ops/sec ±0.57% (93 runs sampled)
chalk x 7,125 ops/sec ±4.23% (69 runs sampled)
clorox x 1,175 ops/sec ±3.95% (71 runs sampled)
kleur x 74,307 ops/sec ±0.40% (96 runs sampled)
ansi-colors x 60,646 ops/sec ±0.49% (96 runs sampled)
chalk x 7,228 ops/sec ±3.25% (73 runs sampled)
clorox x 86,631 ops/sec ±0.59% (94 runs sampled)
kleur x 95,595 ops/sec ±0.24% (96 runs sampled)
# Stacked colors
ansi-colors x 13,547 ops/sec ±0.15% (97 runs sampled)
chalk x 1,631 ops/sec ±4.83% (72 runs sampled)
clorox x 454 ops/sec ±2.43% (40 runs sampled)
kleur x 21,825 ops/sec ±0.31% (94 runs sampled)
ansi-colors x 13,576 ops/sec ±0.42% (93 runs sampled)
chalk x 1,669 ops/sec ±4.56% (71 runs sampled)
clorox x 26,166 ops/sec ±1.44% (91 runs sampled)
kleur x 28,674 ops/sec ±0.29% (93 runs sampled)
# Nested colors
ansi-colors x 27,553 ops/sec ±0.45% (93 runs sampled)
chalk x 3,445 ops/sec ±4.31% (69 runs sampled)
clorox x 552 ops/sec ±2.79% (45 runs sampled)
kleur x 32,405 ops/sec ±0.36% (92 runs sampled)
ansi-colors x 28,712 ops/sec ±0.60% (96 runs sampled)
chalk x 3,446 ops/sec ±4.59% (69 runs sampled)
Clorox x 40,821 ops/sec ±1.90% (94 runs sampled)
kleur x 43,242 ops/sec ±0.17% (97 runs sampled)
```

@@ -186,0 +186,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