best-promise
v0.2.4
Published
select the best promise available at certain moment or leave the choice to the end user
Downloads
22
Readme
best-promise
select the best promise available at certain moment or leave the choice to the end user
language: also available in: -
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){
// ...
});