Promise.asyncto accept legacy node-style callback arguments.
mocha, and ensure we test up to node 9.
Promiseclass is constructed even when using the wrapper interface.
Promisesubclass constructor to avoid costly overhead in ES5 environments. The slow ES6 path is only used if necessary for correctness (or if the native Promise implementation uses ES6 class syntax).
Promise#then0to the API, which is a shim when a native
Promise#then0is not available. Some
Promiseimplementations provide this method, which is much more efficient than calling
Promise#thenand discarding the result.
Promise#then0in internal implementations where appropriate, including
Promise.async(where the use of generators can now yield better performance than chaining promises in the usual way).
Promise.asyncalways returns a
Promise. (Previously if the function returned immediately without yielding the result would not be wrapped in a promise.)
prfunto use native promises.
prfunnow creates a subclass of
Promiseby default, instead of smashing the global
Promise. This only works if your
Promiseimplementation properly supports the ES6 subclass semantics --
es6-shimis known to implement the ES6 spec properly. To smash the global
Promiselike in the bad old days, use
promisifywith named arguments (an array of names as second parameter).
promisifyAPI: following the lead of
qversion 2, the
promisifyfunction has been changed to eliminate the magic variadic argument inference. The
promisifyfunction now takes an explicit second parameter,
names. If the
namesparameter is missing or falsy, then a single argument is used to resolve the promise. If the
true, then the promise is resolved with an array of the variadic arguments to the callback. If the
namesparameter is an array, the array names the variadic arguments, and the promise is resolved with an object containing fields with those names.