0.0.2 • Published 12 years ago

chuk-cb v0.0.2

Weekly downloads
3
License
-
Repository
github
Last release
12 years ago

chuk-cb

Chuk plugin which simplifys writing callbacks in REPL session.

Installation

$ npm install chuk-cb

Usage

After installing cb add this code to your Chukfile

scope.cb = require('chuk-cb')(scope);

Your Chukfile may now look like this:

module.exports = function(scope) {
  // some other initialisation
  scope.cb = require('chuk-cb')(scope);
};

If you now run chuk and you have a call which requires a callback function which arguments you want to use if called, simply pass cb to that call. So instead of

chuk > var foo
chuk > User.findOne({name: 'foo'}, function(err, user) { foo = user; })
chuk > user
{ name: 'foo', haircolor: 'bar' }

simply write

chuk > User.findOne({name: 'foo'}, cb)
_0 = null
_1 = [object Object]
undefined
chuk > _1
{ name: 'foo', haircolor: 'bar' }

As you can see cb adds the parameters of it to the global scope.

0.0.2

12 years ago

0.0.1

12 years ago