cloudhead / eyes.js Goto Github PK
View Code? Open in Web Editor NEWa customizable value inspector for node.js
License: MIT License
a customizable value inspector for node.js
License: MIT License
Add an option to let the user set the number of spaces to indent objects and arrays:
eyes.defaults
:
spaces: 4
In stringifyArray()
and stringifyObject()
change the hardcoded 4's to option.spaces
.
You could always indent the objects, so you could remove the pretty
variable from stringifyObject()
and use options.pretty
.
Hi!
Please, consider injecting in then middle of condition at https://github.com/cloudhead/eyes.js/blob/master/lib/eyes.js#L151 the following
&& o !== null
to cope with JS bug which is typeof null === 'object'
.
TIA,
--Vladimir
It should be like this
"license": {
"type": "MIT",
"url": "http://github.com/kriskowal/eyes.js/raw/master/LICENSE"
},
DEBUG: TypeError: Object.keys called on non-object at Function.keys (native) at /usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:151:50 at Array.some (native) at stringifyArray (/usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:150:59) at /usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:127:38 at stringify (/usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:130:6) at Object.inspect (/usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:50:27) at /usr/local/lib/node/.npm/eyes/0.1.6/package/lib/eyes.js:39:29 at Object.debug (/var/www/arc/lib/utils.js:7:9) at /var/www/arc/routes/contact.js:16:15
I just released a little CLI utility for inspecting JSON with eyes.
https://github.com/adjohnson916/eyes-cli
If you're interested, we could look into integrating the feature proper.
See: https://github.com/nodejitsu/cliff/issues/2#comment_1328724
function typeOf(value) {
to become
eyes.typeOf = function typeOf(value) {
This would be really helpful to me for this issue: https://github.com/nodejitsu/cliff/issues/2#comment_1328724 ... I will be copy / pasting this helper in the meantime and exposing it there.
The original util.inspect
always looks wether an object has the
inspect
property defined as a function. If it is, then it calls it and
prints the result instead of the literal representation.
Classes like Buffer
have inspect
defined so when you do:
console.log( { some: Buffer(2) } )
you get:
{ some: <Buffer d0 c7> }
I think eyes
should respect this, or at least have an option to
do so. The style applied should be the other
style, since what
inspect
returns is often not a literal representation.
When I check the package.json here, it seems that the repository is defined correctly. But on npm registry https://www.npmjs.com/package/eyes there is no repository link. According to 6ef998b it has already been fixed, but probably not published to the registry?
Looks like a simple fix. Add an additional configuration option that is consumed here:
https://github.com/cloudhead/eyes.js/blob/master/lib/eyes.js#L177
$ node -e 'var inspect = require("eyes").inspector({ stream: null }); console.log(inspect({ something: 42 }));' | xxd
0000000: 7b20 1b5b 316d 736f 6d65 7468 696e 671b { .[1msomething.
0000010: 5b32 326d 3a20 1b5b 3335 6d34 321b 5b33 [22m: .[35m42.[3
0000020: 366d 207d 1b5b 3339 6d0a 6m }.[39m.
There ought to be a \x1b[36m
to start off the output. But it just starts off with the open curly bracket.
please print buffers in a more readable form.
with hexy.js would be nice :)
I'd like to be able to print stuff inline like a sentence. Here's a snippet of my setup code:
var eyes = require('eyes');
var eyes_err = eyes.inspector({stream: process.stderr, maxLength: 1024*1024});
// stdout with a newline
function l(){console.log.apply(console,arguments)}
// uses eyes to send pretty output to stderr
function e() {
for (var i=0; i<arguments.length; ++i) {
if (typeof arguments[i] === 'string') {
process.stderr.write(arguments[i] + " ");
} else {
eyes_err(arguments[i]);
}
}
process.stderr.write("\n");
}
This gets me almost there but if I do
e("here is the data", {data: 23}, "and I am done now")
It prints a newline before "and I am done now" which is undesired. I'd in addition prefer for it to let me specify that instead of ending with a newline I actually want it to use a space.
HI,
Eyes blew my node (FATAL ERROR: Allocation failed - process out of memory) when I pointed it at a large object with circular refs.
I guess it doesn't check for circular refs? Or maybe it should stop iterating when it reaches its max string length?
It would be great to have a "max depth" option as well 8-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.