{"name":"looper","description":"async loops that never RangeError","version":"2.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@2.0.0","dist":{"shasum":"66cd0c774af3d4fedac53794f742db56da8f09ec","tarball":"http://registry-npm.ywwl.com/looper/download/looper-2.0.0.tgz","integrity":"sha512-6DzMHJcjbQX/UPHc1rRCBfKlLwDkvuGZ715cIR36wSdYqWXFT35uLXq5P/2orl3tz+t+VOVPxw4yPinQlUDGDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDITdhOHEigTaFG5a0qtEAKq3aZjhIauF/Q9aMdfll0gwIgMUNQLZ8QPnzKq+VXR5TmgXD6kRY4h0/JAZ0hRP+b0EY="}],"size":2104,"noattachment":false,"key":"/looper/-/looper-2.0.0.tgz"},"_from":".","_npmVersion":"1.3.0","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"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":1373349065313,"_cnpm_publish_time":1373349065313,"dist-tags":{"latest":"4.0.0"}}