lib/util/asyncEvents.js
/*
 * Helper function that will always return a promise even if function is
 * synchronous and doesn't return a promise.
 */
Helper function that will always return a promise even if function is
synchronous and doesn't return a promise.
Helper function that will always return a promise even if function is synchronous and doesn ' t return a promise .
function handle() {
  var args = _.toArray(arguments);
  var fn = args.shift();
  var result = fn.apply(this, args);
  if (result instanceof Promise) {
    return result;
  } else {
    return Promise.resolve(result);
  }
}
function handle ( ) { var args = _ . toArray ( arguments ) ; var fn = args . shift ( ) ; var result = fn . apply ( this , args ) ; if ( result instanceof Promise ) { return result ; } else { return Promise . resolve ( result ) ; } }
Helper function that will always return a promise even if function is
 synchronous and doesn't return a promise.
Helper function that will always return a promise even if function is synchronous and doesn ' t return a promise .