- Allow functions created by
Promise.async
to accept legacy node-style callback arguments. - Switch to
eslint
, updatemocha
, and ensure we test up to node 9.
- Add a cache to ensure that only a single
prfun
Promise
class is constructed even when using the wrapper interface. - Update npm dev dependencies.
- Optimize the
Promise
subclass 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). - Added
Promise#then0
to the API, which is a shim when a nativePromise#then0
is not available. SomePromise
implementations provide this method, which is much more efficient than callingPromise#then
and discarding the result. - Used
Promise#then0
in internal implementations where appropriate, includingPromise.async
(where the use of generators can now yield better performance than chaining promises in the usual way).
- Ensure that
Promise.async
always returns aPromise
. (Previously if the function returned immediately without yielding the result would not be wrapped in a promise.)
- Improve compatibilty with environments missing a definition of
Object.setPrototypeOf
.
- Switch from
es6-shim
tocore-js
by default. - Fix our subclass code to follow the latest ES6 specification.
- Work around some bugs in native Promise implementations to allow
prfun
to use native promises.
- Breaking change:
prfun
now creates a subclass ofPromise
by default, instead of smashing the globalPromise
. This only works if yourPromise
implementation properly supports the ES6 subclass semantics --es6-shim
is known to implement the ES6 spec properly. To smash the globalPromise
like in the bad old days, userequire('prfun/smash')
.
- Fix potential resource leak in
Promise#timeout
.
- Added
Promise#tap
,Promise#filter
. - Bug fix to
promisify
with named arguments (an array of names as second parameter).
- Breaking change to
promisify
API: following the lead ofdenodeify
inrsvp
andq
version 2, thepromisify
function has been changed to eliminate the magic variadic argument inference. Thepromisify
function now takes an explicit second parameter,names
. If thenames
parameter is missing or falsy, then a single argument is used to resolve the promise. If thenames
parameter istrue
, then the promise is resolved with an array of the variadic arguments to the callback. If thenames
parameter is an array, the array names the variadic arguments, and the promise is resolved with an object containing fields with those names.
See comments on bower's issue #1403 and this commit on q's v2 branch for more details.
- Initial release.