{"_id":"rafor","_rev":"7-917b2eee806ea30ca11d7875d084d69f","name":"rafor","description":"RequestAnimationFrame friendly async for iterator","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"rafor","version":"1.0.0","description":"RequestAnimationFrame friendly async for iterator","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["async","for","iterator","requestanimationframe","raf"],"author":{"name":"Andrei Kashcha"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/anvaka/rafor.git"},"devDependencies":{"tap":"^1.3.2"},"gitHead":"eee64cd105565a61d66d30dee356fa62acf570bd","bugs":{"url":"https://github.com/anvaka/rafor/issues"},"homepage":"https://github.com/anvaka/rafor#readme","_id":"rafor@1.0.0","_shasum":"08820c3822130ef32e9e15d798f3fe208ca04522","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"anvaka","email":"anvaka@gmail.com"},"maintainers":[{"name":"anvaka","email":"anvaka@gmail.com"}],"dist":{"shasum":"08820c3822130ef32e9e15d798f3fe208ca04522","tarball":"https://registry.npmjs.org/rafor/-/rafor-1.0.0.tgz","integrity":"sha512-92ZfIWcN8MUwYwoVK0TvqVWpREfHVo00zGyCJ04FeFc0e+hfuvmWiATz4PDWP7TGYXNsWvJlmfleWPhaJvNlpQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHOtamBNhFDwXq63jpRbpC0AGola1ugwUbGuYlMVVIy4AiAGm4TL9bQy/ehNLez9fxpFsC3qvRlTufGO7FA+Mu6csg=="}]}},"1.0.1":{"name":"rafor","version":"1.0.1","description":"RequestAnimationFrame friendly async for iterator","main":"index.js","scripts":{"test":"tap test/*.js"},"keywords":["async","for","iterator","requestanimationframe","raf"],"author":{"name":"Andrei Kashcha"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/anvaka/rafor.git"},"devDependencies":{"tap":"^1.3.2"},"gitHead":"25fc9c919ebe93fe8a526d16ae124953e3065828","bugs":{"url":"https://github.com/anvaka/rafor/issues"},"homepage":"https://github.com/anvaka/rafor#readme","_id":"rafor@1.0.1","_shasum":"a8787fa1245dc69c554f281db4a8f8913038e49c","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"anvaka","email":"anvaka@gmail.com"},"maintainers":[{"name":"anvaka","email":"anvaka@gmail.com"}],"dist":{"shasum":"a8787fa1245dc69c554f281db4a8f8913038e49c","tarball":"https://registry.npmjs.org/rafor/-/rafor-1.0.1.tgz","integrity":"sha512-XcVl3ntU+pdxzNYfc+HvfLtt70nweV5eItSWhfeZitlue+r/yJp9Sv36e7fbtbdx1RiAv961VXObDOHwbuoUVw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsgmS1Z7jFRPKZeHg3CUIMcYrCUs4oLbuo2DynkF3OGgIhAOjeV5GVdpN9Pxjx0UTFt8KgXs3BiZrvsTtmqKnEObRz"}]}},"1.0.2":{"name":"rafor","version":"1.0.2","description":"RequestAnimationFrame friendly async for iterator","main":"index.js","scripts":{"test":"tap test/*.js"},"keywords":["async","for","iterator","requestanimationframe","raf"],"author":{"name":"Andrei Kashcha"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/anvaka/rafor.git"},"devDependencies":{"tap":"^1.3.2"},"gitHead":"32d65a180669357441c68c3ddedaa3955d84099b","bugs":{"url":"https://github.com/anvaka/rafor/issues"},"homepage":"https://github.com/anvaka/rafor#readme","_id":"rafor@1.0.2","_shasum":"e927cebcb9d8908da7a931ab0712095f1f199ec9","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"anvaka","email":"anvaka@gmail.com"},"maintainers":[{"name":"anvaka","email":"anvaka@gmail.com"}],"dist":{"shasum":"e927cebcb9d8908da7a931ab0712095f1f199ec9","tarball":"https://registry.npmjs.org/rafor/-/rafor-1.0.2.tgz","integrity":"sha512-b8e8/srbSbC0FZTxivEz9pj5z1mQM8CpCEv1aAxuaK26ljSOHJk8AjimcTaHpHIZlwH/VPbli12LuKKrJyyGmA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCP1Xg35Yq5Cfav8lqdqhLovzEiF1p5r6edFBl97qau2AIgHC9oNxC3Qo158+jw4BiU/3Q4/bH6ohAo4Sa/T8vkwfU="}]}}},"readme":"# rafor [![Build Status](https://travis-ci.org/anvaka/rafor.svg)](https://travis-ci.org/anvaka/rafor)\n\nThis project will allow you to iterate over huge arrays asynchronously without\nimpacting responsiveness of the application.\n\n# usage\n\n``` js\n// Let's say you have a huge array, and you want to find its maximum\n// element. Once element is found you want to report it back to requestor:\nvar asyncFor = require('rafor');\n\nfunction findMaxElement(array, cb) {\n  var max = Number.NEGATIVE_INFINITY;\n\n  asyncFor(array, visit, done);\n\n  function visit(el, index, array) {\n    if (el > max) max = el;\n  }\n\n  function done(array) {\n    cb(max);\n  }\n}\n```\n\nThe code above will attempt to limit its time spent within `visit()` function\nto `8 ms`. This will ensure that your main JavaScript thread is not 100% busy\ncalculating maximum, and the browser still has time to do other operations.\n\nUnlike many other `async for` implementations, this iterator will attempt to\nmaximize number of elements visited within single event loop cycle, while still\nlimiting itself to a given time quota.\n\n## Configuration\n\nIf you want to change time quota of `8 ms` to something different, you can\npass it as an optional argument:\n\n``` js\nasyncFor(array, visit, done, {\n  maxTimeMS: 5 // spend no more than 5 milliseconds on `visit()`\n});\n```\n\nBy default the iterator will visit every single element of your source array.\nIf you want to change iteration step you can also pass it via configuration:\n\n``` js\nasyncFor(array, visit, done, {\n  step: 3 // Visit element 0, 3, 6, 9, 12, ... and so on\n});\n```\n\nFinally, iterator takes its opportunity to measure speed of your `visit()`\ncallback during the first event loop cycle. By default it assumes that visiting\n10,000 elements should be fast enough to not impact responsiveness of the\nbrowser, but if this number is too high or too low for your case, please give\niterator a hint:\n\n``` js\n// Let's say our `visit()` is CPU intensive function, and we assume that\n// calling visit() five times will require 10 to 16 milliseconds (which\n// gives good FPS rate and responsiveess). We can tell the iterator, that\n// it can meause first five calls:\nasyncFor(array, visit, done, {\n  probeElements: 5\n});\n\n// The iterator will keep remeasuring performance of `visit()` callback on\n// every event loop cycle, and will adjust number of calls to `visit()`\n// based on collected data.\n```\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install rafor\n```\n\n# license\n\nMIT\n","maintainers":[{"name":"anvaka","email":"anvaka@gmail.com"}],"time":{"modified":"2022-06-25T09:59:06.655Z","created":"2015-08-04T05:38:13.198Z","1.0.0":"2015-08-04T05:38:13.198Z","1.0.1":"2015-08-04T05:50:15.817Z","1.0.2":"2015-08-05T15:53:36.605Z"},"homepage":"https://github.com/anvaka/rafor#readme","keywords":["async","for","iterator","requestanimationframe","raf"],"repository":{"type":"git","url":"git+https://github.com/anvaka/rafor.git"},"author":{"name":"Andrei Kashcha"},"bugs":{"url":"https://github.com/anvaka/rafor/issues"},"license":"MIT","readmeFilename":"README.md","users":{}}