{"name":"looper","description":"async loops that never RangeError","version":"3.0.0","homepage":"https://github.com/dominictarr/looper","repository":{"type":"git","url":"git://github.com/dominictarr/looper.git"},"dependencies":{},"devDependencies":{"tape":"1.0.4"},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/dominictarr/looper/issues"},"_id":"looper@3.0.0","_shasum":"2efa54c3b1cbaba9b94aee2e5914b0be57fbb749","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"dist":{"shasum":"2efa54c3b1cbaba9b94aee2e5914b0be57fbb749","tarball":"http://registry-npm.ywwl.com/looper/download/looper-3.0.0.tgz","integrity":"sha512-LJ9wplN/uSn72oJRsXTx+snxPet5c8XiZmOKCm906NVYu+ag6SB6vUcnJcWxgnl2NfbIyeobAn7Bwv6xRj2XJg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNU5IqmfrHJqQOTM6LrkYmK83jlutcKVG8RXn0t4R9nAiAsq7STQZ04bnqrQlYQn0s7SgO423/q3OqhKMQzvaxPrg=="}],"size":2024,"noattachment":false,"key":"/looper/-/looper-3.0.0.tgz"},"directories":{},"readme":"# looper\n\nLoop with callbacks but don't RangeError\n\n[![travis](https://travis-ci.org/dominictarr/looper.png?branch=master)\n](https://travis-ci.org/dominictarr/looper)\n\n[![testling](http://ci.testling.com/dominictarr/looper.png)\n](http://ci.testling.com/dominictarr/looper)\n\n## Synopsis\n\nNormally, if `mightBeAsync` calls it's cb immediately\nthis would `RangeError`:\n\n``` js\nvar l = 100000\n;(function next () {\n  if(--l) mightBeAsync(next)\n})\n```\n\n`looper` detects that case, and falls back to a `while` loop,\nin computer science something like this is called a [trampoline](https://en.wikipedia.org/wiki/Trampoline_(computing))\nthis module is simpler than other trampoline libraries such as [tail-call](https://github.com/Gozala/js-tail-call)\nbecause it does not preserve arguments. But this is still useful\nfor looping when  async recursion is sometimes sync.\n\nThis is about 10 times faster than using [setImmediate](http://devdocs.io/node~6_lts/timers#timers_setimmediate_callback_args)\n\n## Example\n\n``` js\nvar looper = require('looper')\n\nvar l = 100000\nvar next = looper(function () {\n  if(--l) probablySync(next)\n})\n\nnext()\n```\n\nwhen you want to stop looping, don't call `next`.\n`looper` checks if each callback is sync or not,\nso you can even mix sync and async calls!\n\n## License\n\nMIT\n\n","publish_time":1408407197848,"_cnpm_publish_time":1408407197848,"dist-tags":{"latest":"4.0.0"}}