package
normalize an object/array where some values may be wrapped in Results
npm install when-allGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
normalize an object/array where some value may be wrapped in Results
$ {package mananger} install jkroso/when-allWith npm
$ npm install --save when-allthen in your app:
var all = require('when-all')Create a Result for a new x with all values lifted out of their Results
all([
getPage('google.com'),
getPage('google.co.nz')
]).then(compare)all({
usa: getPage('google.com'),
nz: getPage('google.co.nz')
}).then(compare)You could decorate a function so it can take Results as arguments.
var all = require('when-all')
function decorate(fn) {
return function(){
var self = this
return all(arguments).then(function(args){
return fn.apply(self, args)
})
}
}
var asyncCompare = decorate(compare)
asyncCompare(
getPage('google.com'),
getPage('google.co.nz')
)$ makeThen open your browser to.
Estimated unpacked size across 7 packages.
21.6 kB
Includes dependencies.
3 direct · 1 outdated