lib/http/routes/json.js
function get( obj ) {
  var pending = 0
    , res     = {}
    , callback
    , done;

  return function _( arg ) {
    switch(typeof arg) {
      case 'function':
        callback = arg;
        break;
      case 'string':
        ++pending;
        obj[ arg ](function( err, val ) {
          if( done ) return;
          if( err ) return done = true, callback(err);
          res[ arg ] = val;
          --pending || callback(null, res);
        });
        break;
    }
    return _;
  };
}
function get( obj ) {
  var pending = 0
    , res     = {}
    , callback
    , done;

  return function _( arg ) {
    switch(typeof arg) {
      case 'function':
        callback = arg;
        break;
      case 'string':
        ++pending;
        obj[ arg ](function( err, val ) {
          if( done ) return;
          if( err ) return done = true, callback(err);
          res[ arg ] = val;
          --pending || callback(null, res);
        });
        break;
    }
    return _;
  };
}
function get ( obj ) { var pending = 0 , res = { } , callback , done ; return function _ ( arg ) { switch ( typeof arg ) { case 'function' : callback = arg ; break ; case 'string' : ++ pending ; obj [ arg ] ( function ( err , val ) { if ( done ) return ; if ( err ) return done = true , callback ( err ) ; res [ arg ] = val ; -- pending || callback ( null , res ) ; } ) ; break ; } return _ ; } ; }
Data fetching helper.
Data fetching helper .