lib/providers/braintree.js
function(obj, name, callback){
      if (!obj) return Belt.noop;

      var s = _.pick(obj, B._api_objects[name + 's']);

      var stream = B._gateway[name].search(function(search){
          _.each(s, function(v, k){
            if (_.isObject(v)) return search[k].call(search)[v.op](v.val, v.val2);

            return search[k].call(search).is(v);
          });
        })
      , results = []
      , err;

      stream.on('data', function(r){
        return results.push(r);
      });
      stream.on('error', function(e){
        return err = e;
      });
      return stream.on('end', function(){
        return callback(err, results);
      });
    }
function(obj, name, callback){
      if (!obj) return Belt.noop;

      var s = _.pick(obj, B._api_objects[name + 's']);

      var stream = B._gateway[name].search(function(search){
          _.each(s, function(v, k){
            if (_.isObject(v)) return search[k].call(search)[v.op](v.val, v.val2);

            return search[k].call(search).is(v);
          });
        })
      , results = []
      , err;

      stream.on('data', function(r){
        return results.push(r);
      });
      stream.on('error', function(e){
        return err = e;
      });
      return stream.on('end', function(){
        return callback(err, results);
      });
    }
function ( obj , name , callback ) { if ( ! obj ) return Belt . noop ; var s = _ . pick ( obj , B . _api_objects [ name + 's' ] ) ; var stream = B . _gateway [ name ] . search ( function ( search ) { _ . each ( s , function ( v , k ) { if ( _ . isObject ( v ) ) return search [ k ] . call ( search ) [ v . op ] ( v . val , v . val2 ) ; return search [ k ] . call ( search ) . is ( v ) ; } ) ; } ) , results = [ ] , err ; stream . on ( 'data' , function ( r ) { return results . push ( r ) ; } ) ; stream . on ( 'error' , function ( e ) { return err = e ; } ) ; return stream . on ( 'end' , function ( ) { return callback ( err , results ) ; } ) ; }
return function with searching criteria
return function with searching criteria