How to use the fibers/future.Future function in fibers

To help you get started, we’ve selected a few fibers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cyberFund / cyber.fund / imports / api / server / utils.js View on Github external
extractFromPromise: function (promise) {
    if (promise.then) {
      var fut = new Future();
      promise.then(function(result) {
        fut["return"](result);
      }, function(error) {
        fut["throw"](error);
      });
      return fut.wait();
    } else { //in case promise already resolved
      return promise;
    }
  },
  escapeRegExp: function (str) {