1eyes 2==== 3 4a customizable value inspector for Node.js 5 6synopsis 7-------- 8 9I was tired of looking at cluttered output in the console -- something needed to be done, 10`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. 11So I decided to have some fun. _eyes_ were born. 12 13![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) 14 15_example of the output of a user-customized eyes.js inspector_ 16 17*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. 18 19usage 20----- 21 22 var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); 23 24 inspect(something); // inspect with the settings passed to `inspector` 25 26or 27 28 var eyes = require('eyes'); 29 30 eyes.inspect(something); // inspect with the default settings 31 32you can pass a _label_ to `inspect()`, to keep track of your inspections: 33 34 eyes.inspect(something, "a random value"); 35 36If you want to return the output of eyes without printing it, you can set it up this way: 37 38 var inspect = require('eyes').inspector({ stream: null }); 39 40 sys.puts(inspect({ something: 42 })); 41 42customization 43------------- 44 45These are the default styles and settings used by _eyes_. 46 47 styles: { // Styles applied to stdout 48 all: 'cyan', // Overall style applied to everything 49 label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` 50 other: 'inverted', // Objects which don't have a literal representation, such as functions 51 key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` 52 special: 'grey', // null, undefined... 53 string: 'green', 54 number: 'magenta', 55 bool: 'blue', // true false 56 regexp: 'green', // /\d+/ 57 }, 58 59 pretty: true, // Indent object literals 60 hideFunctions: false, // Don't output functions at all 61 stream: process.stdout, // Stream to write to, or null 62 maxLength: 2048 // Truncate output if longer 63 64You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. 65 66 var inspect = require('eyes').inspector({ 67 styles: { 68 all: 'magenta', 69 special: 'bold' 70 }, 71 maxLength: 512 72 }); 73 74