Skip to content

emilioplatzer/best-promise

 
 

Repository files navigation

best-promise

select the best promise available at certain moment or leave the choice to the end user

extending npm-version downloads build climate dependencies

language: English also available in: Spanish

Based on any-promise

When testing with Travis-CI best-promise selects a promise library randomly.

In the rest of cases it will work identically to any-promise.

When normal use attempts to load libraries in the following order:

If no library is installed, attempts to export the global Promise (native or polyfill).

You can specify the PROMISE_IMPL env variable or the PROMISE_RANDOM variable to yes

var Promise = require('best-promise').Promise;

return Promise
  .all([xf, f, init, coll])
  .then(fn);

return new Promise(function(resolve, reject){
  try {
    resolve(item);
  } catch(e){
    reject(e);
  }
});

improvements

You can abrevite the common tasks

var Promises = require('best-promise');
var fs = require('fs-promise');

Promises.start(function(){
    return fs.stat(path+path.sep+fileName);
}).then(function(stat){
    // ...
});

License

MIT

About

Support any ES6 Promise Library or Polyfill

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.5%
  • Makefile 5.5%