best-promise

0.2.4 • Public • Published

best-promise

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

extending version downloads Build Status

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){
    // ...
});
 

Readme

Keywords

Package Sidebar

Install

npm i best-promise

Weekly Downloads

84

Version

0.2.4

License

MIT

Last publish

Collaborators

  • tute