🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

chalk

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chalk - npm Package Compare versions

Comparing version

to
0.5.1

33

index.js

@@ -10,2 +10,13 @@ 'use strict';

function build(_styles) {
var builder = function builder() {
return applyStyle.apply(builder, arguments);
};
builder._styles = _styles;
// __proto__ is used because we must return a function, but there is
// no way to create a function with a different prototype.
builder.__proto__ = proto;
return builder;
}
var styles = (function () {

@@ -21,4 +32,3 @@ var ret = {};

get: function () {
this._styles.push(key);
return this;
return build(this._styles.concat(key));
}

@@ -31,5 +41,15 @@ };

var proto = defineProps(function chalk() {}, styles);
function applyStyle() {
// support varags, but simply cast to string in case there's only one arg
var str = arguments.length === 1 ? String(arguments[0]) : [].slice.call(arguments).join(' ');
var args = arguments;
var argsLen = args.length;
var str = argsLen !== 0 && String(arguments[0]);
if (argsLen > 1) {
// don't slice `arguments`, it prevents v8 optimizations
for (var a = 1; a < argsLen; a++) {
str += ' ' + args[a];
}
}

@@ -40,3 +60,4 @@ if (!chalk.enabled || !str) {

var nestedStyles = applyStyle._styles;
/*jshint validthis: true*/
var nestedStyles = this._styles;

@@ -58,7 +79,5 @@ for (var i = 0; i < nestedStyles.length; i++) {

Object.keys(styles).forEach(function (name) {
var style = defineProps(applyStyle, styles);
ret[name] = {
get: function () {
style._styles = [];
return style[name];
return build([name]);
}

@@ -65,0 +84,0 @@ };

{
"name": "chalk",
"version": "0.5.0",
"version": "0.5.1",
"description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.",

@@ -5,0 +5,0 @@ "license": "MIT",