forked from orbit-oss/chalk
simplify logic
This commit is contained in:
parent
fc53420ae4
commit
639f6b95cb
1 changed files with 5 additions and 4 deletions
9
chalk.js
9
chalk.js
|
|
@ -3,12 +3,13 @@ var ansi = require('ansi-styles');
|
|||
var stripAnsi = require('strip-ansi');
|
||||
var hasColor = require('has-color');
|
||||
var defineProps = Object.defineProperties;
|
||||
|
||||
ansi.grey = ansi.gray;
|
||||
var chalk = module.exports;
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
|
||||
ansi.grey = ansi.gray;
|
||||
|
||||
Object.keys(ansi).forEach(function (key) {
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
|
|
@ -21,8 +22,6 @@ var styles = (function () {
|
|||
return ret;
|
||||
})();
|
||||
|
||||
var chalk = module.exports = defineProps({}, init());
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
|
||||
|
|
@ -52,6 +51,8 @@ function init() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
defineProps(chalk, init());
|
||||
|
||||
chalk.styles = ansi;
|
||||
chalk.stripColor = stripAnsi;
|
||||
chalk.supportsColor = hasColor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue