lib/utils/detect-series.js
function _detect(eachFn, arr, iterator, mainCallback) {
  eachFn(arr, function (x, index, callback) {
    iterator(x, function (v, result) {
      if (v) {
        mainCallback(result || x);
        mainCallback = async.noop;
      } else {
        callback();
      }
    });
  }, function () {
    mainCallback();
  });
}
function _detect(eachFn, arr, iterator, mainCallback) {
  eachFn(arr, function (x, index, callback) {
    iterator(x, function (v, result) {
      if (v) {
        mainCallback(result || x);
        mainCallback = async.noop;
      } else {
        callback();
      }
    });
  }, function () {
    mainCallback();
  });
}
function _detect ( eachFn , arr , iterator , mainCallback ) { eachFn ( arr , function ( x , index , callback ) { iterator ( x , function ( v , result ) { if ( v ) { mainCallback ( result || x ) ; mainCallback = async . noop ; } else { callback ( ) ; } } ) ; } , function ( ) { mainCallback ( ) ; } ) ; }
From async.js, modified to return an optional result.
@param eachFn
@param arr
@param iterator
@param mainCallback
@private
From async . js modified to return an optional result .