node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



lazily map functions to a lazy promise


var zed = require('zed')
var z = zed(promise,
z.then(function (val) {
  console.log('we forced evaluation of the lazy promise, then ran it through some things!')

where a, b, and c are functions like you would pass as onFulfilled handlers to promise.then(). That is, if it throws, the resultant promise will be rejected. If it returns a value, that value will be used as the argument for the next function. If it returns a promise, the sequence will wait on that promise to be fulfilled and then use that value as the argument on the next step in the chain.


zed: (Promise, ...Function(Value) => Promise|Value) => LazyPromise

The first argument is any Promises/A+ compatible thenable. Most commonly, it will be a Promise or a LazyPromise. The rest of the arguments are the functions to chain in series order. The functions will not attach .then listeners until the resultant LazyPromise is forced, thus preserving lazy evaluation if the upstream promise is lazy.


$ npm install zed

running the tests

from project root:

$ npm install
$ npm test



MIT. (c) 2013 jden See