heapwolf / cdir Goto Github PK
View Code? Open in Web Editor NEWAn interactive console.dir() for node.js similar to console.dir() in webkit.
An interactive console.dir() for node.js similar to console.dir() in webkit.
Do you expect users to be able to pipe?
$ echo {} | /usr/local/lib/node_modules/cdir/bin/cdir
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
AssertionError: stdin must be initialized before calling setRawMode
at Object.setRawMode (tty.js:37:10)
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/cdir.js:7:5)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/bin/cdir:4:15)
at Module._compile (module.js:432:26)
need tests.
Is there a way to hook a function to be called when selection is changed ( with reference to selected subobject as payload? )
Rather than being limited at "[Function]", it'd be good to be able to expand that out to the fn.toString() value.
That would be really sweet...
Here's a proof-of-concept: https://gist.github.com/1702813
:1: foobar
:2: bla
woah cool markup
I think you are missing something on package.json?
If you try to load anything with circular dependencies, it just keeps trying until it runs out of memory.
The console.dir = require('../dir')
finds nothing. Replacing it with console.dir = require('cdir')
gives this error:
module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'cdir'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/home/kyle/temp.js:1:77)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Array.0 (module.js:484:10)
It is installed globally. whereis cdir
results in cdir: /usr/local/bin/cdir
I'm on Ubuntu running node 0.6.19
Would be good to use process.stdin.setRawMode()
instead of tty.setRawMode()
.
need to fix.
Got this whilst trying to use it on a req object.
Let me know if you want more details about the req.
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object.keys called on non-object
at Function.keys (native)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:284:20)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:321:11)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:343:11)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:343:11)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:343:11)
at constructMeta (/usr/local/lib/node_modules/cdir/cdir.js:343:11)
at Array.0 (/usr/local/lib/node_modules/cdir/cdir.js:690:5)
Reported by @coderarity
$ cdir
/usr/local/lib/node_modules/cdir/cdir.js:10
if (process.stdin._events.keypress[0]) {
^
TypeError: Cannot read property 'keypress' of undefined
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/cdir.js:10:26)
at Module._compile (module.js:449:26)
at Object..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/bin/cdir:4:15)
at Module._compile (module.js:449:26)
at Object..js (module.js:467:10)
Reproduce by executing:
// RUN: echo '{"hallo": true}' | node tools/interactive.js
console.dir = require('cdir');
process.stdin.once('data', function (chunk) {
console.dir(JSON.parse(chunk.toString()));
});
process.stdin.resume();
result is:
Assertion failed: (!!(events & UV__IO_READ) ^ !!(events & UV__IO_WRITE)), function uv__stream_io, file ../deps/uv/src/unix/stream.c, line 729.
Abort trap: 6
This is the error I get if I try to console.dir() when also using node's debugger:
< /sites/pc_node_apps/cdir/cdir.js:10
< if (process.stdin._events.keypress[0]) {
< ^
< TypeError: Cannot read property 'keypress' of undefined
< at Object. (/sites/pc_node_apps/cdir/cdir.js:10:26)
< at Module._compile (module.js:446:26)
< at Object..js (module.js:464:10)
< at Module.load (module.js:353:31)
< at Function._load (module.js:311:12)
< at Module.require (module.js:359:17)
< at require (module.js:375:17)
< at Object. (/sites/pc_node/test.js:1:77)
< at Module._compile (module.js:446:26)
< at Object..js (module.js:464:10)
program terminated
How can I fix this?
Hi, I would like to use cdir as inspector for nested object, where sub objects are retrieved as result of async call. Are you aware if anyone has started to work on something like this? If not, any hints where to start?
should consider the repl wants stdin. preserve and remove repl events, give them back on dir() exit.
$ npm install cdir -g
$ cdir package.json
/usr/local/lib/node_modules/cdir/cdir.js:10
if (process.stdin._events.keypress[0]) {
^
TypeError: Cannot read property 'keypress' of undefined
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/cdir.js:10:26)
at Module._compile (module.js:449:26)
at Object..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/usr/local/lib/node_modules/cdir/bin/cdir:4:15)
at Module._compile (module.js:449:26)
at Object..js (module.js:467:10)
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.