Coder Social home page Coder Social logo

eyes.js's People

Contributors

chakrit avatar indexzero avatar kesla avatar laverdet avatar mattijs avatar mmalecki avatar nrw avatar vladikoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eyes.js's Issues

Some changes

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.

error thrown when null passed in

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

An option to respect Object.inspect()

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.

First color code is wrong

$ 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.

Option to not add newline

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.

Blew my node

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-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.