{"_id":"promise-extended","_rev":"3220960","name":"promise-extended","description":"Promises implementation with chainable API","dist-tags":{"latest":"0.0.9"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"time":{"modified":"2024-03-21T07:22:13.000Z","created":"2013-01-16T21:25:36.673Z","0.0.9":"2014-04-02T00:29:50.939Z","0.0.8":"2013-06-06T21:41:02.839Z","0.0.7":"2013-06-05T05:40:12.584Z","0.0.6":"2013-05-08T21:46:01.695Z","0.0.5":"2013-04-16T16:14:50.941Z","0.0.4":"2013-03-21T21:49:51.435Z","0.0.3":"2013-01-22T07:50:07.025Z","0.0.2":"2013-01-17T22:45:11.236Z","0.0.1":"2013-01-16T21:25:36.673Z"},"users":{},"author":{"name":"Doug Martin"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"versions":{"0.0.9":{"name":"promise-extended","version":"0.0.9","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","arguments-extended":"~0.0.3","declare.js":"~0.0.3"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"1.3.2","grunt-contrib-uglify":"~0.2.0","grunt":"~0.4.1","grunt-contrib-jshint":"~0.3.0"},"bugs":{"url":"https://github.com/doug-martin/promise-extended/issues"},"homepage":"https://github.com/doug-martin/promise-extended","_id":"promise-extended@0.0.9","dist":{"shasum":"fb164fba66e23ba85bc54f34124a7e9bb8f409df","size":18249,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.9.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1396398590939,"_hasShrinkwrap":false,"_cnpm_publish_time":1396398590939,"_cnpmcore_publish_time":"2021-12-16T13:34:10.244Z"},"0.0.8":{"name":"promise-extended","version":"0.0.8","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","arguments-extended":"~0.0.3","grunt":"~0.4.1","declare.js":"~0.0.3","grunt-contrib-jshint":"~0.3.0"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"*","grunt-contrib-uglify":"~0.2.0"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/doug-martin/promise-extended/issues"},"_id":"promise-extended@0.0.8","dist":{"shasum":"b880dbf4572a61a8d1a1ef0cb486b75f8baa137b","size":12410,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.8.tgz"},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1370554862839,"_hasShrinkwrap":false,"_cnpm_publish_time":1370554862839,"_cnpmcore_publish_time":"2021-12-16T13:34:10.490Z"},"0.0.7":{"name":"promise-extended","version":"0.0.7","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","grunt":"~0.4.1","declare.js":"~0.0.3","grunt-contrib-jshint":"~0.3.0"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"*","grunt-contrib-uglify":"~0.2.0"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/doug-martin/promise-extended/issues"},"_id":"promise-extended@0.0.7","dist":{"shasum":"c53021d781450abb0e332c3b07a13a355aed1393","size":12453,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.7.tgz"},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1370410812584,"_hasShrinkwrap":false,"_cnpm_publish_time":1370410812584,"_cnpmcore_publish_time":"2021-12-16T13:34:10.758Z"},"0.0.6":{"name":"promise-extended","version":"0.0.6","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","grunt":"~0.4.1","declare.js":"~0.0.3","grunt-contrib-jshint":"~0.3.0"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"*","grunt-contrib-uglify":"~0.2.0"},"readmeFilename":"README.md","_id":"promise-extended@0.0.6","dist":{"shasum":"d1d62c87d04af3537b3c57caf50d8ec7c3824c0c","size":12386,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.6.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1368049561695,"_hasShrinkwrap":false,"_cnpm_publish_time":1368049561695,"_cnpmcore_publish_time":"2021-12-16T13:34:10.951Z"},"0.0.5":{"name":"promise-extended","version":"0.0.5","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","grunt":"~0.4.1","declare.js":"~0.0.3","grunt-contrib-jshint":"~0.3.0"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"*","grunt-contrib-uglify":"~0.2.0"},"readmeFilename":"README.md","_id":"promise-extended@0.0.5","dist":{"shasum":"6e51c214117d9d395a81533c2ff88a4809741050","size":12121,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.5.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1366128890941,"_hasShrinkwrap":false,"_cnpm_publish_time":1366128890941,"_cnpmcore_publish_time":"2021-12-16T13:34:11.189Z"},"0.0.4":{"name":"promise-extended","version":"0.0.4","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":["ie/8..latest","chrome/20..latest","firefox/14..latest","safari/latest","iphone/6","ipad/6"]},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","grunt":"~0.4.1","declare.js":"~0.0.3","grunt-contrib-jshint":"~0.3.0"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.3.0","promises-aplus-tests":"*","grunt-contrib-uglify":"~0.2.0"},"readmeFilename":"README.md","_id":"promise-extended@0.0.4","dist":{"shasum":"97ee6f553a21d5edca4b04ff959d5fc25f0749a8","size":12088,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.4.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1363902591435,"_hasShrinkwrap":false,"_cnpm_publish_time":1363902591435,"_cnpmcore_publish_time":"2021-12-16T13:34:11.423Z"},"0.0.3":{"name":"promise-extended","version":"0.0.3","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"testling":{"files":"test/browserling.js","browsers":{"ie":[6,7,8,9],"chrome":[4,23,"canary"],"firefox":[3,3.5,3.6,4,17,"nightly"],"opera":[10,10.5,11,11.5,11.6,12,"next"],"safari":["5.0.1",5.1]}},"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"~0.0.3","is-extended":"~0.0.3","array-extended":"~0.0.3","function-extended":"~0.0.3","declare.js":"~0.0.3"},"devDependencies":{"it":"~0.2.0","grunt-it":"~0.2.0","promises-aplus-tests":"*"},"readmeFilename":"README.md","_id":"promise-extended@0.0.3","dist":{"shasum":"61fb90f369842b595f9f8b91a627388a72ede320","size":12035,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.3.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1358841007025,"_hasShrinkwrap":false,"_cnpm_publish_time":1358841007025,"_cnpmcore_publish_time":"2021-12-16T13:34:11.638Z"},"0.0.2":{"name":"promise-extended","version":"0.0.2","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extended":"0.0.2","is-extended":"0.0.2","array-extended":"0.0.2","function-extended":"0.0.2","declare.js":"0.0.3"},"devDependencies":{"it":"~0.1.0","grunt-it":"~0.2.0","promises-aplus-tests":"*"},"readmeFilename":"README.md","_id":"promise-extended@0.0.2","dist":{"shasum":"bc3d4006bbdf30711dc2d44d1e10a68ac0bb2c28","size":11789,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.2.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1358462711236,"_hasShrinkwrap":false,"_cnpm_publish_time":1358462711236,"_cnpmcore_publish_time":"2021-12-16T13:34:11.835Z"},"0.0.1":{"name":"promise-extended","version":"0.0.1","description":"Promises implementation with chainable API","main":"index.js","scripts":{"test":"it -r dot"},"repository":{"type":"git","url":"git:git@github.com:doug-martin/promise-extended.git"},"keywords":["Promise","extender","utilities"],"author":{"name":"Doug Martin"},"license":"MIT","dependencies":{"extender":"0.0.4","is-extended":"0.0.1","array-extended":"0.0.1","function-extended":"0.0.1","declare.js":"0.0.3"},"devDependencies":{"it":"~0.1.0","grunt-it":"~0.2.0","promises-aplus-tests":"*"},"readmeFilename":"README.md","_id":"promise-extended@0.0.1","dist":{"shasum":"24a9ac7059aa474987bf066ce0875aced4e87514","size":11794,"noattachment":false,"key":"/promise-extended/-/promise-extended-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-extended/download/promise-extended-0.0.1.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"damartin","email":"doug@dougamartin.com"},"maintainers":[{"name":"damartin","email":"doug@dougamartin.com"}],"directories":{},"publish_time":1358371536673,"_hasShrinkwrap":false,"_cnpm_publish_time":1358371536673,"_cnpmcore_publish_time":"2021-12-16T13:34:12.031Z"}},"readme":"<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\"\n         title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\n</a>\n\n[![Build Status](https://travis-ci.org/doug-martin/promise-extended.svg?branch=master)](https://travis-ci.org/doug-martin/promise-extended)\n\n[![browser support](https://ci.testling.com/doug-martin/promise-extended.png)](https://ci.testling.com/doug-martin/promise-extended)\n\n# promise-extended\n\n`promise-extended` is a Javascript library that can be used standalone or incorporated into [`extended`](https://github.com/doug-martin/extended)\n\n```javascript\nvar promise = require(\"promise-extended\");\n```\n\nOr\n\n```javascript\nvar myextended = require(\"extended\")\n\t.register(require(\"promise-extended\"));\n```\n\n## Installation\n\n```\nnpm install promise-extended\n```\n\nOr [download the source](https://raw.github.com/doug-martin/promise-extended/master/index.js) ([minified](https://raw.github.com/doug-martin/promise-extended/master/promise-extended.min.js))\n\n## Usage\n\n**`Promise`**\n\nThe promise constructor used by `promise` and `defer`\n\n**`Promise#callback`**\n\nResolve a promise with the given value.\n\n**`Promise#errback`**\n\nReject a promise with the given value.\n\n**`Promise#callback`**\n\nResolve a promise with the given value.\n\n**`Promise#then(callback[, errback)`**\n\nAllows the chaining of promises.\n\n```\nfunction myAsyncAction(num){\n    var p = new promise.Promise();\n    setTimeout(funciton(){\n        p.callback(num);\n    }, 50);\n    return p.promise();\n}\n\nmyAsyncAction(1)\n    .then(function(num){\n        return myAsyncAction(num+1);\n    })\n    .then(function(num){\n        return myAsyncAction(num+1);\n    })\n    .then(function(num){\n        console.log(num); //3\n    });\n\n```\n\nErrors are propagated the the nearest error handler, this allows the bubbling of errors up a chain of promises.\n\n```\nfunction myAsyncAction(num){\n    var p = new promise.Promise();\n    setTimeout(funciton(){\n        p.callback(num);\n    }, 50);\n    return p.promise();\n}\n\nmyAsyncAction(1)\n    .then(function(num){\n        throw new Error(\"oops an error occured\");\n    })\n    .then(function(num){\n        return myAsyncAction(num+1);\n    })\n    .then(\n        function(num){\n            console.log(num); //3\n        },\n        function(err){\n            console.log(err); //oops an error occured.\n        }\n    );\n\n```\n\nOf you return a promise from an error handler that resolved successfully then the next promise is the chain will be resolved successfully.\n\n```\nfunction myAsyncAction(num){\n    var p = new promise.Promise();\n    setTimeout(funciton(){\n        p.callback(num);\n    }, 50);\n    return p.promise();\n}\n\nmyAsyncAction(1)\n    .then(function(num){\n        throw new Error(\"oops an error occured\");\n    })\n    .then(function(num){\n        return myAsyncAction(num+1);\n    })\n    .then(\n        function(num){\n            console.log(num); //3\n        },\n        function(err){\n            console.log(err); //oops an error occured.\n            return asyncAction(10);\n        }\n    )\n    .then(function(num){\n        console.log(num); //10\n    });\n\n```\n\n**`Promise#both`**\n\nAllows the execution of a function regardless of whether or not a promises is successful.\n\n```\n\nnew promise.Promise().errback(\"error\").both(function(){\n    //do some more work\n}).then(function(){\n\n});\n\n```\n\n**`Promise#resolve`**\n\nThe resolve method provides a mechanism to work with node style callbacks and promises.\n\n```javascript\n\nvar fs = require(\"fs\");\n\nvar myPromise = new promise.Promise();\nfs.readFile(__dirname + \"/myFile.txt\", \"utf8\", myPromise.resolve);\n\nmyPromise.then(function(txt){\n    console.log(txt);\n});\n\n```\n\n**`Promise#classic`**\n\nAccepts a callback in the typical node style.\n\n```\n\nnew promise.Promise()\n    .callback(\"hello\")\n    .classic(function(err, res){\n        console.log(res); //\"hello\"\n    });\n\n```\n\n**`isPromiseLike`**\n\nDetermines if an object is like a promise (contains a `.then` function).\n\n```javascript\n\npromise.isPromiseLike({then : function(){}}); //true\npromise({then : function(){}}).isPromiseLike(); //true\n\n```\n\n\n**`promise`**\n\nCreates a new promise.\n\n```javascript\nfunction myAsyncAction(){\n    var p = promise.promise();\n    setTimeout(funciton(){\n        p.callback(\"hello\");\n    }, 50);\n    return p.promise();\n}\n\nmyAsyncAction().then(function(hello){\n    console.log(hello);\n});\n\n```\n\n**`promiseList`**\n\nCreates a new promise.\n\n```javascript\nfunction myAsyncAction(){\n    var p = promise.promise();\n    setTimeout(funciton(){\n        p.callback(\"hello\");\n    }, 50);\n    return p.promise();\n}\n\npromise.promiseList([myAsyncAction(), myAsyncAction()]).then(function(hello){\n    console.log(hello); //[\"hello\", \"hello\"]\n});\n\n```\n\n**`defer`**\n\nCreates a new promise.\n\n```javascript\nfunction myAsyncAction(){\n    var p = promise.defer();\n    setTimeout(funciton(){\n        p.callback(\"hello\");\n    }, 50);\n    return p.promise();\n}\n\nmyAsyncAction.then(function(hello){\n    console.log(hello);\n});\n\n```\n\n**`deferredList`**\n\nCreates a new promise.\n\n```javascript\nfunction myAsyncAction(){\n    var p = promise.defer();\n    setTimeout(funciton(){\n        p.callback(\"hello\");\n    }, 50);\n    return p.promise();\n}\n\npromise.deferredList([myAsyncAction(), myAsyncAction()]).then(function(hello){\n    console.log(hello); //[\"hello\", \"hello\"]\n});\n\n```\n\n**`resolve`**\n\nCreates a promise that is resolved with the provided value.\n\n```javascript\n\npromise.resolve(\"hello\")\n    .then(function(hello){\n        console.log(hello); //hello\n    });\n\n```\n\n**`reject`**\n\nCreates a promise that is errored with the provided value.\n\n```javascript\n\npromise.reject(new Error(\"an error occured\"))\n    .then(function(){\n        //not called\n    }, function(err){\n       console.log(err.stack);\n    });\n\n```\n\n\n**`wrap`**\n\nWraps traditional node style functions with a promise.\n\n```javascript\n\nvar fs = require(\"fs\");\nvar readFile = promise.wrap(fs.readFile, fs);\nreadFile(__dirname + \"/test.json\").then(\n    function(buffer){\n        console.log(contents);\n    },\n    function(err){\n       console.error(err);\n    }\n);\n```\n\n**`serial`**\n\nExecutes a list of items in a serial manner.\n\nIf the list contains promises then each promise will be executed in a serial manner.\n\nIf the list contains non async items then the next item in the list is called.\n\n**Note** This will not propogate values from one action to another, instead results are passed as an array to the eventual promise.\n\n```javascript\n\nfunction asyncAction(item, timeout){\n    return function(){\n        var p = promise.promise();\n        setTimeout(function(){\n            return p.callback(item);\n        }, timeout);\n        return p.promise();\n    }\n};\n\npromise.serial([\n    asyncAction(1, 1000),\n    asyncAction(2, 900),\n    asyncAction(3, 800),\n    asyncAction(4, 700),\n    asyncAction(5, 600),\n    asyncAction(6, 500),\n    asyncAction(7, 400),\n    asyncAction(8, 300),\n    asyncAction(9, 200),\n]).then(function(results){\n    console.log(results); // [1,2,3,4,5,6,7,8, 9];\n});\n\n```\n\n\n**`chain`**\n\nAllows you to propogate results from one function to another.\n\nThis is different than `.serial` in that it propogates results from one promise to the next, where `.serial` does not.\n\n```javascript\n\nfunction asyncAction(add, timeout) {\n\n     return function (num) {\n         num = num || 0;\n         var p = promise.promise();\n         setTimeout(function () {\n              p.callback(num + add);\n         }, timeout);\n         return p.promise();;\n     }\n}\n\npromise.chain([\n     asyncAction(1, 100),\n     asyncAction(2, 100),\n     asyncAction(3, 100),\n     asyncAction(4, 100),\n     asyncAction(5, 100),\n]).then(function(results){\n     console.log(results); //15\n});\n\n```\n\n**`wait`**\n\nEnsures that a promise is resolved before a the function can be run.\n\nFor example suppose you have to ensure that you are connected to a database before you execute a function.\n\n```\nvar findUser = promise.wait(connect(), function findUser(id){\n     //this wont execute until we are connected\n     return User.findById(id);\n});\n\npromise.when(findUser(1), findUser(2)).then(function(users){\n    var user1 = users[0], user2 = users[1];\n });\n\n```\n","_attachments":{},"homepage":"https://github.com/doug-martin/promise-extended","bugs":{"url":"https://github.com/doug-martin/promise-extended/issues"},"license":"MIT"}