New changes are described in CHANGELOG.md v0.7.6 -- 2017.03.15 * Fix errors in documentation * Prevent stack trace related range errors v0.7.5 -- 2016.01.28 * Fix few stack trace overflow vulnerabilities * Improve delay arguments handling. `timeout` is now optional if not provided then `nextTick` is used otherwise proper validation of input value takes place. v0.7.4 -- 2015.11.18 * `every` extension * `dynamicQueue` util v0.7.3 -- 2015.09.10 * `find` extension (Array's find for promises) * Fix spelling of LICENSE v0.7.2 -- 2015.01.07 * Force assimilation of pre v0.7 deferred promises. Using them as own raised serious bugs * Configure lint scripts in package.json v0.7.1 -- 2014.04.27 * Update internals to use latest versions of dependencies v0.7.0 -- 2014.04.04 Major (breaking) changes: * Fix error handling: Up to v0.6.x promise could have been rejected only with error instance, and same way they couldn't be successfully resolved with an error instance. It was not an issue if we followed good practices, still it didn't match `throw` behavior (any JavaScript value can be thrown). Starting from v0.7 promise can be rejected and resolved with any kind of value. It's also how promises behave in other implementations including upcoming ECMAScript 6 standard. * Assimilate foreign promises. Promises from other implemantations (including native promises) are detected and assimilated for recursive resolution. Addresses issue #29 * Rename `promise.match` to `promise.spread`, this is the name under which this functionality was popularized in other libraries. * Remove `end`, as it was replaced by `done` in v0.6.4 (`end` was kept as an alias to not break current programs) * Move modules from `lib` to root folder Other changes: * Expose `resolve` and `reject` functions on deferred. It complies to `Promise.resolve` and `Promise.reject` * Remove Makefile (it's cross-environment package) * Fix handling of promise arguments in promisifySync v0.6.8 -- 2013.12.27 * Function version of `invokeAsync` utility (further addresses #26) v0.6.7 -- 2013.12.27 * `callAsync` utility, to promisify asynchronous functions inline in algorithm. Fixes #26 v0.6.6 -- 2013.10.14 * Fix stack overflow vulnerability in `reduce` implementation, as diagnosed here: https://github.com/cujojs/promise-perf-tests/blob /e58b90c2660914411c96efe854446444160b592a/lib/tests/reduce-large.js#L25 * Introduce `examples` directory. First examples introduced by Marc-Aurèle DARCHE (@madarche). Thanks! * Improve benchmarks, and add kew and bluebird to them (and remove jQuery) * Documentation: Fix profiler example and general improvements v0.6.5 -- 2013.06.05 * `catch` extension * Unify listeners handling in promises handled by gate * Improve documentation v0.6.4 -- 2013.05.15 * Rename `done` to `end` and leave `end` as an alias for `done`. With v0.7 release `end` alias will be removed. v0.6.3 -- 2013.03.21 * promise.finally extension v0.6.2 -- 2013.03.18 * Provide deferred.reject to allow configuration of v0.7 safe working flows * Do not require whole event-emitter but just needed modules v0.6.1 -- 2012.10.05 * Fix profiler paths detection to work on Windows systems * Fix monitor test so it's not dependent on order in which is run * Added When implementation to benchmarks v0.6.0 -- 2012.09.22 Major refactor, with focus on performance and better modularization. * New Deferred is about x3 faster than v0.5 version * Promise is now also an event emitter * Better extensions system (deferred.extend) * `aside` extension (derived from `cb`), that allows to split promise chain * New `cb` extension with different semantics, allows escaping promise chain with typical asynchronous function callback * Refactored Array#map, it doesn't support any more limit argument (it should be now achieved with help of deferred.gate) * Refactored Array#reduce, added support for sparse arrays * Array#some - added support for sparse arrays * Changed signature of `end` it's now on pair with `then` and newly introduced `aside` extension * Profiler - gather promise initialization statistics * Removed promise.js module, some of it's logic is left as internal _ext.js module and other part was merged into deferred.js * Benchmarks v0.5.6 -- 2012-07.17 (Maintenance, as v0.6 is nearly ready for rollout). Added workaround for for v8 bug (eminent in Node v0.6): Defining property via descriptor on plain function, prevents us from setting same property directly later on different function. v0.5.5 -- 2012.06.13 * deferred.some - (array & promise extension). Promise aware Array's some for array-like objects. * Fix handling of callbacks in `cb` promise extension. Only success callback mode was not handled correctly. * Mark functions that returns promises with 'returnsPromise' flag, and provide awareness of that in `promisify` extensions, so they return same functions back if they're called on such. * Files reorganization so internal modules are no longer in utils folder but instead are prefixed with '_' (it's convention we use in other projects) v0.5.4 -- 2012.05.28 * deferred.gate - (function extension) Handles maximum concurrency number for given asynchronous task. Additionally postponed calls queue length can also be limited to chosen number * Modify code so we can use es5-ext at it's latest version v0.5.3 -- 2012.05.04 * Fixed resolution of synchronous calls in a queue of map extension, they were not resolved as expected v0.5.2 -- 2012.05.02 * Fixed serious issue in `get` extension, which in some scenarios made errors in following resolved flow silent v0.5.1 -- 2012.04.29 * Fixed error handling in invoke extension for case in which context object is null or undefined v0.5.0 -- 2012.04.18 * Addons & Improvements * Resigned from dual async/sync: `invoke` extension and `promisify` method. Such abstraction lead to unexpected results in some cases. `invokeSync` is from now on `invoke` (`invokeSync` is no longer available), `promisifyAsync` is now `promisify` (`promisifyAsync` is no longer available). * Brought back `cb` extension in slightly different form. It's useful for creating "hybrid" asynchronous functions that both take callback and return promise, it can also be useful if we want to split promise chain, return promise and carry on with other flow. * `get` now accepts more than one argument, this way we can with one call get to nested properties of object * `extend` functions that helps in configuration of promise extensions now accepts array of validation functions that should be called on extension initial call. * Input arguments of promise extensions are now validated on initial call. It is quite important as error now can be easily tracked down, if we propagate our error to some next event loop it's more problematic. * Fixes * Arguments validation in `extend` function was broken * When run on resolved promises, errors invoked by some extensions where not propagated into promise chain as expected v0.4.3 -- 2012.02.20 * Improvements: * Added support for fourth argument in deferred.map through which we can set maximum number of tasks that should be run simultaneously * Exposed `promisifyAsync` and `promisifySync` on deferred, and exposed by default `invokeSync` and `invokeAsync` promise extensions * Added possibility to add just onsuccess callback to `end` * Optimize internal logic by reducing number of created unresolved promises * Code validation with JSLint * Fixes: * Removed invalid doubled call from invoke extensions * Handle exceptions thrown by asynchronous functions v0.4.2 -- 2012.01.26 * Optimization. Cut down promise creation time about 60% v0.4.1 -- 2012.01.26 * Fixed logic error for multi argument `deferred` call. It was same case as with `map` fixed with v0.4.0: In specific cases resolve was called in callback passed to promise, cause of that any errors that occurred in same event loop were silent. v0.4.0 -- 2012.01.19 * Changed the way `end` behaves: * When called without arguments, throws error if promise is rejected * When called with one function argument, it's treated as callback passed to Node.js style asynchronous function. When promise is resolved it is called with two arguments, first is error if promise is rejected, second is resolved value if promise succeeds. * When called with two function arguments, first one is taken as onsuccess and second as onerror (it behaves similar as `then` but it doesn't extend chain with another promise) * It no longer returns its promise * Fixed `map` extension. There was logic error: in specific cases resolve of map was called in callback passed to promise, cause of that any errors that occurred in same event loop were silent. * Removed `cb` extension as now `end` has same functionality v0.3.1 -- 2012.01.13 * Promisify and invoke extension now resolves also input arguments before calling the function * Possibility to preset fixed number of arguments for promisified function, it makes promisified functions less error prone v0.3.0 -- 2012.01.08 Major update: * Revised promise collections approach: There's no longer all, join & first functions. Instead we may use deferred for grouping promises: deferred(p1, p2, p3) or use map or reduce extensions e.g. deferred.map(paths, readFile). See documentation for more info * Introduced promise extensions. * cb - end promise chain with regular asynchronous callback * get - get property of resolved object * invoke - invoke function on resolved object (supports both synchronous and asynchronous functions) * map - promise aware version of Array's map * match - match result array to function arguments * reduce promise aware version of Array's reduce * Replaced asyncToPromise (used as a2p or ba2p) and syncToPromise (used as s2p or bs2p) with 'promisify', it works as 'bind' version for both asynchronous and synchronous functions and is available on deferred as deferred.promisify. It has also been improved to support asynchronous functions that return more than one value. * Rewritten internal logic. Currently promises are backed with _base object which is different for resolved and unresolved promises * Removed nextTick rule, no new event loops are introduced by deferred. * Unresolved promises can now be tracked via deferred.MONITOR * valueOf promise function. Returns self promise if unresolved and resolved value if resolved * isPromise returns true only for deferred's like promise, as deferred api diverged from other promises implementations it's no open anymore to work with foreign promises. * Exposed 'isPromise' & 'delay' functions on deferred v0.2.6 -- 2011.12.12 * Cleared npm warning for misnamed property in package.json v0.2.5 -- 2011.11.08 * Fix for bug introduced with node.js >= 0.5.7 ( https://github.com/joyent/node/issues/1877 ) v0.2.4 -- 2011.08.09 * Expose 'promise' function on deferred object returned by index.js. There are valid use cases for using it outside of deferred lib v0.2.3 -- 2011.08.09 * 'delay' function: delay execution of given function, return promise for function result v0.2.2 -- 2011.08.08 * Added TAD test suite to devDependencies, configured test commands. Tests can be run with 'make test' or 'npm test' v0.2.1 -- 2011.08.08 * Use process.nextTick instead of setTimeout if available v0.2.0 -- 2011.08.08 * Renamed 'chain' dir into 'join' as it's more about joining promises * promise is now promise.then function (promise === promise.then) * resolve returns promise, handful for quick function returns (return d.resolve(x)) * syncToPromise function * Compatibility with es5-ext v0.6 * Test with TAD v0.1.2 -- 2011.07.11 * Make it possible to use it with older JavaScript implementations * Removed dead code * Better tests coverage v0.1.1 -- 2011.07.07 * Documentation v0.1.0 -- 2011.07.05 * Initial version