Merge pull request #120 from grit96/master

Fix #119 - use util.inspect for logging objects
This commit is contained in:
DABH 2018-03-25 12:41:04 -07:00 committed by GitHub
commit fa977f1a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
The MIT License (MIT)
Original Library
Original Library
- Copyright (c) Marak Squires
Additional functionality
@ -33,6 +33,7 @@ module['exports'] = colors;
colors.themes = {};
var util = require('util');
var ansiStyles = colors.styles = require('./styles');
var defineProps = Object.defineProperties;
@ -91,14 +92,11 @@ var styles = (function () {
var proto = defineProps(function colors() {}, styles);
function applyStyle() {
var args = arguments;
var argsLen = args.length;
var str = argsLen !== 0 && String(arguments[0]);
if (argsLen > 1) {
for (var a = 1; a < argsLen; a++) {
str += ' ' + args[a];
}
}
var args = Array.prototype.slice.call(arguments);
var str = args.map(function(arg) {
return typeof arg === 'object' ? util.inspect(arg) : arg;
}).join(' ');
if (!colors.enabled || !str) {
return str;