colorprint
Advanced tools
Comparing version 5.0.3 to 6.0.1
/** | ||
* Print ansi-colored message to stdout/stderr. | ||
* @version 5.0.3 | ||
* @version 6.0.1 | ||
* @module colorprint | ||
@@ -8,3 +8,4 @@ * @author {@link http://okunishitaka.com|Taka Okunishi | ||
* @requires {@link https://www.npmjs.org/package/cli-color|cli-color@^1.1.0 | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.9.0 | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.20.0 | ||
* @requires {@link https://www.npmjs.org/package/supports-color|supports-color@^7.0.0 | ||
*/ | ||
@@ -11,0 +12,0 @@ |
@@ -11,19 +11,22 @@ /** | ||
'use strict' | ||
"use strict"; | ||
const cliColor = require('cli-color') | ||
const cliColor = require("cli-color"); | ||
const supportsColor = require("supports-color"); | ||
/** @lends decorateMsg */ | ||
function decorateMsg (msg, color) { | ||
function decorateMsg(msg, color) { | ||
if (!color) { | ||
return msg | ||
return msg; | ||
} | ||
let decorator = color && cliColor[ color ] | ||
if (!supportsColor.stdout) { | ||
return msg; | ||
} | ||
let decorator = color && cliColor[color]; | ||
if (!decorator) { | ||
throw new Error('Unknown color: ' + color) | ||
throw new Error("Unknown color: " + color); | ||
} | ||
return decorator(msg) | ||
return decorator(msg); | ||
} | ||
module.exports = decorateMsg | ||
module.exports = decorateMsg; |
{ | ||
"name": "colorprint", | ||
"version": "5.0.3", | ||
"version": "6.0.1", | ||
"description": "Print ansi-colored message to stdout/stderr.", | ||
@@ -33,13 +33,14 @@ "main": "lib", | ||
"cli-color": "^1.1.0", | ||
"commander": "^2.9.0" | ||
"commander": "^2.20.0", | ||
"supports-color": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"ababel": "^5.0.10", | ||
"amocha": "^5.0.1", | ||
"ape-releasing": "^5.0.4", | ||
"ape-tasking": "^4.0.7", | ||
"ape-tmpl": "^6.0.13", | ||
"ape-updating": "^5.0.2", | ||
"ababel": "^6.0.3", | ||
"amocha": "^6.0.0", | ||
"ape-releasing": "^5.0.7", | ||
"ape-tasking": "^4.0.12", | ||
"ape-tmpl": "^6.0.14", | ||
"ape-updating": "^5.0.3", | ||
"babel-runtime": "^6.26.0", | ||
"coz": "^7.0.14" | ||
"coz": "^7.0.19" | ||
}, | ||
@@ -46,0 +47,0 @@ "engines": { |
/** | ||
* Print ansi-colored message to stdout/stderr. | ||
* @version 5.0.3 | ||
* @version 6.0.1 | ||
* @module colorprint | ||
@@ -8,3 +8,4 @@ * @author {@link http://okunishitaka.com|Taka Okunishi | ||
* @requires {@link https://www.npmjs.org/package/cli-color|cli-color@^1.1.0 | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.9.0 | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.20.0 | ||
* @requires {@link https://www.npmjs.org/package/supports-color|supports-color@^7.0.0 | ||
*/ | ||
@@ -29,2 +30,2 @@ 'use strict'; | ||
module.exports = colorprint; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIkNvbG9ycHJpbnQiLCJyZXF1aXJlIiwiY2xpQ29sb3IiLCJkZWZpbmUiLCJjcmVhdGUiLCJjb2xvcnByaW50IiwiT2JqZWN0IiwiYXNzaWduIiwiY29sb3JzIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7OztBQVVBOztBQUVBLElBQU1BLFVBQVUsR0FBR0MsT0FBTyxDQUFDLGNBQUQsQ0FBMUI7O0FBQ0EsSUFBTUMsUUFBUSxHQUFHRCxPQUFPLENBQUMsV0FBRCxDQUF4Qjs7QUFDQSxJQUFNRSxNQUFNLEdBQUdGLE9BQU8sQ0FBQyxVQUFELENBQXRCOztBQUNBLElBQU1HLE1BQU0sR0FBR0gsT0FBTyxDQUFDLFVBQUQsQ0FBdEI7O0FBRUEsSUFBSUksVUFBVSxHQUFHRCxNQUFNLEVBQ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b2xvcnByaW50XG4iXX0= |
@@ -10,5 +10,7 @@ /** | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
var cliColor = require('cli-color'); | ||
var cliColor = require("cli-color"); | ||
var supportsColor = require("supports-color"); | ||
/** @lends decorateMsg */ | ||
@@ -22,6 +24,10 @@ | ||
if (!supportsColor.stdout) { | ||
return msg; | ||
} | ||
var decorator = color && cliColor[color]; | ||
if (!decorator) { | ||
throw new Error('Unknown color: ' + color); | ||
throw new Error("Unknown color: " + color); | ||
} | ||
@@ -33,2 +39,2 @@ | ||
module.exports = decorateMsg; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlY29yYXRlX21zZy5qcyJdLCJuYW1lcyI6WyJjbGlDb2xvciIsInJlcXVpcmUiLCJkZWNvcmF0ZU1zZyIsIm1zZyIsImNvbG9yIiwiZGVjb3JhdG9yIiwiRXJyb3IiLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7O0FBVUE7O0FBRUEsSUFBTUEsUUFBUSxHQUFHQyxPQUFPLENBQUMsV0FBRCxDQUF4QjtBQUVBOzs7QUFDQSxTQUFTQyxXQUFULENBQXNCQyxHQUF0QixFQUEyQkMsS0FBM0IsRUFBa0M7QUFDaEMsTUFBSSxDQUFDQSxLQUFMLEVBQVk7QUFDVixXQUFPRCxHQUFQO0FBQ0Q7O0FBQ0QsTUFBSUUsU0FBUyxHQUFHRCxLQUFLLElBQUlKLFFBQVEsQ0FBRUksS0FBRixDQUFqQzs7QUFDQSxNQUFJLENBQUNDLFNBQUwsRUFBZ0I7QUFDZCxVQUFNLElBQUlDLEtBQUosQ0FBVSxvQkFBb0JGLEtBQTlCLENBQU47QUFDRDs7QUFDRCxTQUFPQyxTQUFTLENBQUNGLEdBQUQsQ0FBaEI7QUFDRDs7QUFFREksTUFBTSxDQUFDQyxPQUFQLEdBQWlCTixXQUFqQiIs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Z2VzIHRvIGRlY29yYXRlTXNnLlxuICogQHBhcmFtIHtzdHJpbmd9IGNvbG9yIC0gTmFtZSBvZiBjb2xvci5cbiAqIEByZXR1cm5zIHtzdHJpbmd9ICAtIERlY29yYXRlZCBtZXNzYWdlLlxuICovXG5cblwidXNlIHN0cmljdFwiO1xuXG5jb25zdCBjbGlDb2xvciA9IHJlcXVpcmUoXCJjbGktY29sb3JcIik7XG5jb25zdCBzdXBwb3J0c0NvbG9yID0gcmVxdWlyZShcInN1cHBvcnRzLWNvbG9yXCIpO1xuXG4vKiogQGxlbmRzIGRlY29yYXRlTXNnICovXG5mdW5jdGlvbiBkZWNvcmF0ZU1zZyhtc2csIGNvbG9yKSB7XG4gIGlmICghY29sb3IpIHtcbiAgICByZXR1cm4gbXNnO1xuICB9XG4gIGlmICghc3VwcG9ydHNDb2xvci5zdGRvdXQpIHtcbiAgICByZXR1cm4gbXNnO1xuICB9XG4gIGxldCBkZWNvcmF0b3IgPSBjb2xvciAmJiBjbGlDb2xvcltjb2xvcl07XG4gIGlmICghZGVjb3JhdG9yKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBjb2xvcjogXCIgKyBjb2xvcik7XG4gIH1cbiAgcmV0dXJuIGRlY29yYXRvcihtc2cpO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGRlY29yYXRlTXNnO1xuIl19 |
63159
873
3
+ Addedsupports-color@^7.0.0
+ Addedhas-flag@4.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
Updatedcommander@^2.20.0