Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

a customizable value inspector for node.js

License

NotificationsYou must be signed in to change notification settings

cloudhead/eyes.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a customizable value inspector for Node.js

synopsis

I was tired of looking at cluttered output in the console -- something needed to be done,sys.inspect() didn't display regexps correctly, and was too verbose, and I had an hour or two to spare.So I decided to have some fun.eyes were born.

eyes-ss

example of the output of a user-customized eyes.js inspector

eyes also deals with circular objects in an intelligent way, and can pretty-print object literals.

usage

var inspect = require('eyes').inspector({styles: {all: 'magenta'}});inspect(something); // inspect with the settings passed to `inspector`

or

var eyes = require('eyes');eyes.inspect(something); // inspect with the default settings

you can pass alabel toinspect(), to keep track of your inspections:

eyes.inspect(something, "a random value");

If you want to return the output of eyes without printing it, you can set it up this way:

var inspect = require('eyes').inspector({ stream: null });sys.puts(inspect({ something: 42 }));

customization

These are the default styles and settings used byeyes.

styles: {                 // Styles applied to stdout    all:     'cyan',      // Overall style applied to everything    label:   'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`    other:   'inverted',  // Objects which don't have a literal representation, such as functions    key:     'bold',      // The keys in object literals, like 'a' in `{a: 1}`    special: 'grey',      // null, undefined...    string:  'green',    number:  'magenta',    bool:    'blue',      // true false    regexp:  'green',     // /\d+/},pretty: true,             // Indent object literalshideFunctions: false,     // Don't output functions at allstream: process.stdout,   // Stream to write to, or nullmaxLength: 2048           // Truncate output if longer

You can overwrite them with your own, by passing a similar object toinspector() orinspect().

var inspect = require('eyes').inspector({    styles: {        all: 'magenta',        special: 'bold'    },    maxLength: 512});

About

a customizable value inspector for node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp