{"_id":"concurrent","_rev":"34-03a58c7885caf4d8bdbab261b5823c52","name":"concurrent","description":"Promises/A+ with Scala awesomeness","dist-tags":{"latest":"0.3.2"},"versions":{"0.0.0":{"name":"concurrent","version":"0.0.0","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","readme":"concurrent\n==========\n\nPromises/A+ with Scala awesomeness\n","_id":"concurrent@0.0.0","dist":{"shasum":"3f2974e448819585281b48967bdcff6c0c0db1d3","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.0.tgz","integrity":"sha512-HfKwpbRd1loT1Dm6xe2ojHMZYB3xeVxeXFq4jP+upKX8HqVIxPR5veDNmQ9eaR4TsSvTO62++vhcSeJ6gTYxRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEgUN62a0dFzqpYUKbb2NxrSIzLlFldpjCM2J6Q+HyYGAiAPNS2OA1i9zzq0nN9LWMgb4HU9eL7w8Z41GS5Gh6E0GA=="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.1":{"name":"concurrent","version":"0.0.1","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n","bugs":{"url":"https://github.com/pspeter3/concurrent/issues"},"_id":"concurrent@0.0.1","dist":{"shasum":"a8d9ea9f192240dfdda44bb6e5eaf09459e15f55","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.1.tgz","integrity":"sha512-ksbFa3yj9opVPUYj5eYeXYTWXF2WdNMwA3eQFzYDnGGerbfwkkUs6KwS0iivK2aXp5FSmPhv95x+m+/mtySJgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFIUydhrp8drbzdm9erhIlWyxFGcnR3DFuzU3QvtE4MWAiEA4jB/gPA2OqMHMxWgXYKXqfvme2ps9y+5+N0HL5gXCZY="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.2":{"name":"concurrent","version":"0.0.2","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n","_id":"concurrent@0.0.2","dist":{"shasum":"8313468f9750cbd0c1ac0622b7adc0d56181e67e","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.2.tgz","integrity":"sha512-Ri6ueQxg/OfoOgoTv1RHtLEAIYfFrHTW+YydBZi/HnTGmcpomX/6zjtQcH6lkqe1ml9rz8XFVCnAn8VkmVoYKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAVpNvByoYzIjWIwrK3MNz4g3pAzqaKaa2274MhaYJpqAiB+5fjYfxbSaPpe+ZhVTO9sBUa6oCebZrSGH/q/RqfQBQ=="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.3":{"name":"concurrent","version":"0.0.3","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n","_id":"concurrent@0.0.3","dist":{"shasum":"ea37c33cf21e73780850a3abb88dbd3456b03d06","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.3.tgz","integrity":"sha512-ZGo7QCZ0eHUv5MICTnvr9XqcrA+yz+U4NvQFih/MDh6+eyNQWD9LMpyhSVlceULNzRmbRS3XZmWaMlTuy5oDIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDq527k+/R2q2tUmopDp2k/kjcoBVAa4oZgKOGOmoN0TQIgeOpoyhYy/qTVM5/1hIKXXKmn2PKpIhv2XCAP8+OEH10="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.4":{"name":"concurrent","version":"0.0.4","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n","_id":"concurrent@0.0.4","dist":{"shasum":"1441944e02bf278de251bab7a291155b3cd7b0c2","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.4.tgz","integrity":"sha512-w8K31kfurH6xEEd06QiX8Ow2Z+EJrVtr+Nu0s3gUG4axQ+mBfQhBUcWDafot/Al+Hhih4fq9Otc/nMtTLT/d9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWeQTC2xmyotUw14u9KID10jjS9wRRqvWM0cyGh482qAIhANGVUUwGXqsJU7aYg76Y4x7VdT8fIaNt0VMpqsjIdGKl"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.5":{"name":"concurrent","version":"0.0.5","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.0.5","dist":{"shasum":"de7df6697a6f040412e5defec41a71fa61a623ae","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.5.tgz","integrity":"sha512-4yeruuO6LtgPnB4VoWMPUny3VQ7hRSo5j5FKK/25wBv14Ugk1FQ4sv+S6sdfSCHMN69BKHHS1cX5ZwlOyppPYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNHYDzbFNmcgn4tEpIGgqExcD8FWXS8xLAd2WBDERhGgIgFHNstwJMMcNsxuKRj5sK1qSu1db6eO81d2jswjcSbT0="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.6":{"name":"concurrent","version":"0.0.6","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.0.6","dist":{"shasum":"d7ffd561db4526558df2669d58868bc19371674c","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.6.tgz","integrity":"sha512-PrGRalkASUYJ4HQkvA9ulGeErWqO5d/6TmTH3why60PdDhSaFCe4FmAnfPWJcp/5eEZn/5Omxr5VGXzZ1MUY1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCocZBPkKGLaJBHES6SR1wB8alh+eyksmulb3ay4tYbRgIhAKvcnjGugWNtZbC+VUn0D70rxjV59vl9LFL8WLvOmX2y"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.7":{"name":"concurrent","version":"0.0.7","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.0.7","dist":{"shasum":"bd1feec86c622b933e23e37131bf183913356349","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.7.tgz","integrity":"sha512-3L4XxFAmWVAXu0+FGPCkS1U1c2CPHvfTZQExI757m61PS0lkX/MV6wvlueAwy+ItYbvAwlpS/DzV+KsmxNnfTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCM20D63RKAYQb7kHxAgiwrmydOvjm5FO0Q18VeJkUOSAIgbMoHU0y3DIM5uTE8MYGxOT0iGsvU6zKuNvOiCKOQQOE="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.0.8":{"name":"concurrent","version":"0.0.8","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the a bare bones promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.0.8","dist":{"shasum":"601fad198ba01019a810507c23f1e56143bcd032","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.0.8.tgz","integrity":"sha512-hZF6T5sisequub+rc78c6PjmLFiyViO6NDqR0siha93AKR8wZ8UwHrZ4p4wEyz7iGwNRtopSB9mDKc+fLjtKcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF3qK6VG6L95iOqVQyvCxW6j0fUEx3HQeCx/2D+ML41hAiEAn6Wf8jHemQF3iPm9PDMCFms7nkvn/rOWlIj66uaLw00="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.1.0":{"name":"concurrent","version":"0.1.0","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the a bare bones promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.1.0","dist":{"shasum":"ea10a7c0a2e3d2525c3e07b1a9798a3c2b813e25","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.1.0.tgz","integrity":"sha512-U6DFlBkl4S2Gbc2CcYuqJ5bKFHm6JUXBwNP92/pDmht6U5jRf29cG5zzbswoBCm1UT4NC9HAyraf/0Ke0+dHOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAdDP56NqJgG3yPYLBsjmKQIuH2Z8Ud6Vw+6XKHV++AwIhAMWAK05it0XC0DN78ZG8wyJzgD/BdLuxvHxs2Dmuvi/y"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.2.1":{"name":"concurrent","version":"0.2.1","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1","grunt-contrib-concat":"~0.3.0","grunt-shell":"~0.3.1","grunt-contrib-uglify":"~0.2.2","grunt-bump":"0.0.11"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the a bare bones promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nBrowsers\n--------\n\nConcurrent can be used in browser environments that support ES5, specifically\n`forEach`, `Array.isArray` and `Object.create`.\n\nCredits\n-------\n\nThere was a lot of inspiration for this project and getting it done. I would\nlike to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.2.1","dist":{"shasum":"7ee5cfb911b89e5c281d21ae008fda816ae5846d","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.2.1.tgz","integrity":"sha512-2wjTXFcDiTCekndhJ2Hmug+RadOTONgwWuyBaEcQne28GdKmOBCKCywGEalZD+YPRPTX4EScNXBrYbC0hHX75g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBEr4Lnxcjr8Lp7O/0Rjvq/slsoIRxezTqN2x21pql1XAiEAh/StjYUbGpEo8enLuNv5gsndfvCenfWB92C+9ui9rYs="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.2.2":{"name":"concurrent","version":"0.2.2","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1","grunt-contrib-concat":"~0.3.0","grunt-shell":"~0.3.1","grunt-contrib-uglify":"~0.2.2","grunt-bump":"0.0.11"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the bare bones Promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other Promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nBrowsers\n--------\n\nConcurrent can be used in browser environments that support ES5, specifically\n`forEach`, `Array.isArray` and `Object.create`. Look at this [JsFiddle](http://jsfiddle.net/pspeter3/h3MLs/)\nas an example of using the libary in the browser.\n\nCredits\n-------\n\nA lot of people had a hand in inspiring this project and helping getting it done. I'd like to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","_id":"concurrent@0.2.2","dist":{"shasum":"096bfceeefbbf31b447c5990549ec8b47ef0f959","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.2.2.tgz","integrity":"sha512-Jny2RsIE8IXgqN0cUgXaPl1IVe5nhkoufSngb8Ux5mAao1PRIYa/DWAE1iezb2WsikXGNSRfwEostqGj/tcAsg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEoWAISgEKErEjnUEvLg/vtvoTeBkUPjt7IQrfkORe5uAiEA6vCoaM3bTVHifY8lE8dQKClT2ST9LTXYfvFbTIKwAik="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.3.0":{"name":"concurrent","version":"0.3.0","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1","grunt-contrib-concat":"~0.3.0","grunt-shell":"~0.3.1","grunt-contrib-uglify":"~0.2.2","grunt-bump":"0.0.11"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the bare bones Promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other Promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nBrowsers\n--------\n\nConcurrent can be used in browser environments that support ES5, specifically\n`forEach`, `Array.isArray` and `Object.create`. Look at this [JsFiddle](http://jsfiddle.net/pspeter3/h3MLs/)\nas an example of using the libary in the browser.\n\nCredits\n-------\n\nA lot of people had a hand in inspiring this project and helping getting it done. I'd like to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","bugs":{"url":"https://github.com/pspeter3/concurrent/issues"},"_id":"concurrent@0.3.0","dist":{"shasum":"c6c306b73e1bcbc2b7a08a4e2a92a193044a651f","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.3.0.tgz","integrity":"sha512-yS1hmeUeIgC0wNq+0P3BzqobmcH7Rpo/VYvdpjbauzzG71xmVwM8Mqpl6mnf3YiuMtuKGxX+dUg877b5l/FHsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFIqWzhT8JRQEXaw31sbD/iB9zwGNruG7BKWp2DySU2sAiBsKtSyKdYZit2uu9uKKh7CMF6tWC/6RQVR3q5+49pwGw=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.3.1":{"name":"concurrent","version":"0.3.1","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1","grunt-contrib-concat":"~0.3.0","grunt-shell":"~0.3.1","grunt-contrib-uglify":"~0.2.2"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the bare bones Promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other Promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nBrowsers\n--------\n\nConcurrent can be used in browser environments that support ES5, specifically\n`forEach`, `Array.isArray` and `Object.create`. Look at this [JsFiddle](http://jsfiddle.net/pspeter3/h3MLs/)\nas an example of using the libary in the browser.\n\nCredits\n-------\n\nA lot of people had a hand in inspiring this project and helping getting it done. I'd like to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","bugs":{"url":"https://github.com/pspeter3/concurrent/issues"},"_id":"concurrent@0.3.1","dist":{"shasum":"9750c491e0361320da261774dbaa0734cbaebeff","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.3.1.tgz","integrity":"sha512-T8hV+EcTXgs86c1jsIb2D9jY/nFTFeT4BK+0/n+IW2vgLhkXSrtmFK0iZgE13RY1N71HWXmbeLKMJKYbn3yd8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE7evxFiZg1G7lHatB7ntaYjm27EGBXyyHbRk5xI4mTlAiBApqqWwLn5cEKQd9WuZRYirvZjg23Lm0/pQFw+EqkRag=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]},"0.3.2":{"name":"concurrent","version":"0.3.2","description":"Promises/A+ with Scala awesomeness","main":"index.js","scripts":{"test":"mocha test/*_spec.js --reporter spec"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"keywords":["promises","aplus","scala","futures","concurrent","async"],"author":{"name":"Phips Peter"},"license":"MIT","readmeFilename":"README.md","gitHead":"de0a26f9add46f5687715e848f93d915680ae728","devDependencies":{"promises-aplus-tests":"*","mocha":"~1.12.0","chai":"~1.7.2","chai-spies":"~0.5.1","grunt":"~0.4.1","grunt-contrib-jshint":"~0.6.3","grunt-gh-pages":"~0.7.1","grunt-contrib-concat":"~0.3.0","grunt-shell":"~0.3.1","grunt-contrib-uglify":"~0.2.2"},"readme":"Concurrent\n==========\n\nPromises/A+ with Scala Awesomeness [![Build Status](https://travis-ci.org/pspeter3/concurrent.png)](https://travis-ci.org/pspeter3/concurrent)\n\nExamples\n--------\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar req = function(options) {\n  var future = new Future();\n  request(options, future.convert(['res', 'body']));\n  return future;\n};\n\n/**\n * Example #1: Simple Async Call\n */\n// Fetch Google with a SLA\nvar google = req('http://google.com').ready(1000);\n\n// Fetch the status\nvar status = google.map(function(value) {\n  return value.res.statusCode;\n});\n\n// Log the final result\nstatus.onSuccess(function(statusCode) {\n  console.log(statusCode);\n});\n\n/**\n * Examples #2: Parallel Calls\n */\nvar duckDuckGo = req('http://duckduckgo.com');\nvar bingOrYahoo = req('http://bing.com').fallbackTo(req('http://yahoo.com'));\n\nvar asArray = Future.sequence([google, duckDuckGo, bingOrYahoo]);\n\nasArray.onSuccess(function(values) {\n  console.log(values);\n});\n\nvar asObject = Future.sequence({\n  google: google,\n  duckDuckGo: duckDuckGo,\n  bingOrYahoo: bingOrYahoo\n});\n\nvar recoverable = asObject.recover({\n  promises: 'A+'\n});\n```\n\nBenchmarks\n----------\n\nHere are the top 5 libraries for some of the tests\n\n```text\n==========================================================\nTest: promise-fulfill x 10000\n----------------------------------------------------------\nlaissez:    |   3.00\nconcurrent: ▇▇  14.00\ndeferred:   ▇▇  19.00\nwhen:       ▇▇▇▇▇  36.00\nq:          ▇▇▇▇▇▇▇▇  57.00\n\n==========================================================\nTest: promise-reject x 10000\n----------------------------------------------------------\nconcurrent: |   6.00\navow:       ▇▇▇▇▇▇▇▇  55.00\nq:          ▇▇▇▇▇▇▇▇▇  60.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇  89.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 118.00\n\n==========================================================\nTest: promise-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   8.00\nwhen:       ▇▇▇▇▇▇▇▇ 204.00\nconcurrent: ▇▇▇▇▇▇▇▇ 207.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 335.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 421.00\n\n==========================================================\nTest: defer-fulfill x 10000\n----------------------------------------------------------\nlaissez:    ▇  21.00\nconcurrent: ▇▇▇▇  62.00\nwhen:       ▇▇▇▇▇▇▇ 103.00\navow:       ▇▇▇▇▇▇▇▇▇ 142.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 424.00\n\n==========================================================\nTest: defer-reject x 10000\n----------------------------------------------------------\navow:       ▇▇▇  50.00\nconcurrent: ▇▇▇▇▇  80.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇ 160.00\nlaissez:    ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 240.00\nq:          ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 378.00\n\n==========================================================\nTest: defer-sequence x 10000\n----------------------------------------------------------\nlaissez:    |   7.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇ 176.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇ 209.00\ndeferred:   ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 271.00\navow:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 352.00\n\n==========================================================\nTest: map x 10000\n----------------------------------------------------------\ndeferred:   ▇▇▇▇▇  39.00\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇ 103.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 385.00\n\n==========================================================\nTest: reduce-large x 10000\nNOTE: in node v0.8.14, deferred.reduce causes a\nstack overflow for an array length >= 610\n----------------------------------------------------------\nconcurrent: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 371.00\nwhen:       ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 502.00\n```\n\nYou can find more performance results [here](https://github.com/pspeter3/promise-perf-tests)\n\nOverview\n--------\n\n### Simple Promise\n\nConcurrent supports the bare bones Promise implementation that supports\n`then(onFulfilled, onRejected)`, `fulfill(value)`, `reject(reason)`.\n\n```js\nvar Promise = require('concurrent').Promise;\n\nvar success = new Promise();\nsuccess.then(function(value) {\n  console.log(value); // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Promise();\nfailure.then(null, function(reason) {\n  console.log(reason); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/promise.js.html)\n\n### Futures\n\nConcurrent also provides a Future class which inherits from Promise. It has a\nlot of syntactic sugar on top of the Promises/A+ spec based on the Scala Future\nAPI.\n\n```js\nvar Future = require('concurrent').Future;\n\nvar success = new Future();\nsuccess.onComplete(function(result) {\n  console.log(result; // 'success'\n});\nsuccess.fulfill('success');\n\nvar failure = new Future();\nfailure.onComplete(function(result) {\n  console.log(result); // 'failure'\n});\nfailure.reject('failure');\n```\n\n[Documentation](http://pspeter3.com/concurrent/future.js.html)\n\n### Collections\n\nConcurrent also provides a collections library which gives a lot of the standard\niterators. All the iterators are performed asynchronously and return Futures.\nThe following methods are supported:\n\n- `forEach`\n- `every`\n- `some`\n- `filter`\n- `map`\n- `reverse`\n- `reduce`\n- `reduceRight`\n\n[Documentation](http://pspeter3.com/concurrent/collections.js.html)\n\n### Working with existing callbacks\n\nFutures also have support for working with existing callback style libraries by\nusing the `convert` method which returns a callback handler.\n\n```js\nvar Future = require('concurrent').Future;\nvar request = require('request');\n\nvar google = new Future();\ngoogle.map(function(value) {\n  var body = value[1]; // Request returns a response and a body\n  console.log(body); // HTML for http://www.google.com\n});\nrequest('http://www.google.com', google.convert());\n```\n\n### Working with other Promise implementations\n\nSince concurrent implements the Promises/A+ spec, it should work with other\nlibraries that implement the spec. Also, the Future class internally does not\nexpect any method beyond `then`, `fulfill`, and `reject` so the prototype\nmethods can be merged into other implementations as long as they have those\nthree methods.\n\nBrowsers\n--------\n\nConcurrent can be used in browser environments that support ES5, specifically\n`forEach`, `Array.isArray` and `Object.create`. Look at this [JsFiddle](http://jsfiddle.net/pspeter3/h3MLs/)\nas an example of using the libary in the browser.\n\nCredits\n-------\n\nA lot of people had a hand in inspiring this project and helping getting it done. I'd like to thank:\n\n- [@brikis98](https://github.com/brikis98) for helping me come up with the idea\n- [Promises, understanding by doing](http://modernjavascript.blogspot.com/2013/08/promisesa-understanding-by-doing.html) for the initial promise spec\n- [cujos/when](https://github.com/cujojs/when) for fully featured examples\n- [aheckmann/mpromise](https://github.com/aheckmann/mpromise) for node.js specific implementation\n- [promises-aplus/promises-tests](https://github.com/promises-aplus/promises-tests) for the test suite\n- [Scala Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) For API sugar\n\nLicense\n-------\n\nThis is licensed under the MIT license. See the LICENSE file\n","bugs":{"url":"https://github.com/pspeter3/concurrent/issues"},"_id":"concurrent@0.3.2","dist":{"shasum":"0eaa0011a15798c56351128f22247f6e2317f50e","tarball":"https://registry.npmjs.org/concurrent/-/concurrent-0.3.2.tgz","integrity":"sha512-KoUIH3pHceLMOeviiAnOzdQ8630lNclszDv8IGXx2Gn+5xXZroLqSWWzisweX//X7LyYOCKy10398bb0ksjvsA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDu1IdEbSaIUGwhdTu/j9C5opPjee9Qd4omnMojMni3QgIgE7Em1s1yydBUSJqqYCotORukktASFHHNhBS/qjOJIZU="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"pspeter3","email":"pspeter333@gmail.com"},"maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}]}},"readme":"concurrent\n==========\n\nPromises/A+ with Scala awesomeness\n","maintainers":[{"name":"pspeter3","email":"pspeter333@gmail.com"}],"time":{"modified":"2022-06-13T20:44:45.670Z","created":"2013-08-23T16:49:09.462Z","0.0.0":"2013-08-23T16:49:10.491Z","0.0.1":"2013-08-25T00:49:28.156Z","0.0.2":"2013-08-25T03:06:10.183Z","0.0.3":"2013-08-25T09:34:49.956Z","0.0.4":"2013-08-25T09:46:16.737Z","0.0.5":"2013-08-25T21:23:56.888Z","0.0.6":"2013-08-25T21:28:33.392Z","0.0.7":"2013-08-26T14:46:01.967Z","0.0.8":"2013-08-27T05:33:14.734Z","0.1.0":"2013-08-27T06:13:23.598Z","0.2.1":"2013-08-27T07:04:28.591Z","0.2.2":"2013-08-27T07:39:57.399Z","0.3.0":"2013-09-13T00:17:02.167Z","0.3.1":"2013-09-13T01:41:38.562Z","0.3.2":"2013-09-18T22:32:44.305Z"},"author":{"name":"Phips Peter"},"repository":{"type":"git","url":"git://github.com/pspeter3/concurrent.git"},"users":{"ivangaravito":true}}