mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-30 11:30:08 +00:00 
			
		
		
		
	Fix #119 - use util.inspect for logging objects
This commit is contained in:
		
							parent
							
								
									1f617ecdc5
								
							
						
					
					
						commit
						8b51cf67b5
					
				| @ -33,6 +33,7 @@ module['exports'] = colors; | |||||||
| 
 | 
 | ||||||
| colors.themes = {}; | colors.themes = {}; | ||||||
| 
 | 
 | ||||||
|  | var util = require('util'); | ||||||
| var ansiStyles = colors.styles = require('./styles'); | var ansiStyles = colors.styles = require('./styles'); | ||||||
| var defineProps = Object.defineProperties; | var defineProps = Object.defineProperties; | ||||||
| 
 | 
 | ||||||
| @ -87,14 +88,11 @@ var styles = (function () { | |||||||
| var proto = defineProps(function colors() {}, styles); | var proto = defineProps(function colors() {}, styles); | ||||||
| 
 | 
 | ||||||
| function applyStyle() { | function applyStyle() { | ||||||
|   var args = arguments; |   var args = Array.prototype.slice.call(arguments); | ||||||
|   var argsLen = args.length; | 
 | ||||||
|   var str = argsLen !== 0 && String(arguments[0]); |   var str = args.map(function(arg) { | ||||||
|   if (argsLen > 1) { |     return typeof arg === 'object' ? util.inspect(arg) : arg; | ||||||
|     for (var a = 1; a < argsLen; a++) { |   }).join(' '); | ||||||
|       str += ' ' + args[a]; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   if (!colors.enabled || !str) { |   if (!colors.enabled || !str) { | ||||||
|     return str; |     return str; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user