Giter Site home page Giter Site logo

Comments (8)

ccheever avatar ccheever commented on September 22, 2024

I think you want something like https://github.com/laverdet/node-fibers

I made a nesh plugin https://github.com/ccheever/nesh-fibrous that let's you do things like

fibrous-coffee> User.fromId('3be25495-30c0-4ac1-9841-14965496c63d', (err, result) -> console.log result); 0
0
fibrous-coffee> { props:
   { __createdTime__: 1388723937299,
     __lastUpdatedTime__: 1393627323048,
     id: '3be25495-30c0-4ac1-9841-14965496c63d',
     name: 'Charlie Cheever',
     photoUrl: 'http://650x-us-standard.s3-website-us-east-1.amazonaws.com/misc-jpeg/HiRbF4xwQSO1pMvx_TnXCw.jpeg' },
  __syncedTime__: 1394497060524 }

undefined
fibrous-coffee> cdc = User.sync.fromId('3be25495-30c0-4ac1-9841-14965496c63d')
{ props:
   { __createdTime__: 1388723937299,
     __lastUpdatedTime__: 1393627323048,
     id: '3be25495-30c0-4ac1-9841-14965496c63d',
     name: 'Charlie Cheever',
     photoUrl: 'http://650x-us-standard.s3-website-us-east-1.amazonaws.com/misc-jpeg/HiRbF4xwQSO1pMvx_TnXCw.jpeg' },
  __syncedTime__: 1394497084108 }
fibrous-coffee>

from nesh.

felipeccastro avatar felipeccastro commented on September 22, 2024

The original question was even simpler than that, but this is awesome!
I installed this plugin and now the console is much better to work with, thanks very much!

from nesh.

danielgtaylor avatar danielgtaylor commented on September 22, 2024

Thanks @ccheever. Glad you guys got this working nicely 👍

from nesh.

ccheever avatar ccheever commented on September 22, 2024

console.log(require('util').inspect(result)) is the answer to your original question, btw.

from nesh.

danielgtaylor avatar danielgtaylor commented on September 22, 2024

BTW, the util module should be available in the global scope by default, so there's no need to require it:

console.log(util.inspect(result));

from nesh.

felipeccastro avatar felipeccastro commented on September 22, 2024

Thanks @ccheever , but that's still not quite the same.
See the difference between the first and the second commands: it looks like util.inspect is converting the object into a string, and using with console.log it loses the colors.

nesh

from nesh.

ccheever avatar ccheever commented on September 22, 2024

http://nodejs.org/api/util.html#util_customizing_util_inspect_colors

nesh> console.log(util.inspect({1:2},{colors:true}))
{ '1': 2 }

from nesh.

felipeccastro avatar felipeccastro commented on September 22, 2024

ah! That's the one!

from nesh.

Related Issues (20)

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.