{"_id":"random-array-iterator","_rev":"1284643","name":"random-array-iterator","description":"An iterator to iterate an array in random order with controls to requeue or dequeue elements during the iteration","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-10-19T10:51:05.000Z","created":"2020-11-30T17:25:21.313Z","1.0.0":"2020-11-30T17:26:13.168Z","0.0.0":"2020-11-30T17:25:21.313Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/random-array-iterator.git"},"versions":{"1.0.0":{"name":"random-array-iterator","version":"1.0.0","description":"An iterator to iterate an array in random order with controls to requeue or dequeue elements during the iteration","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.3","tape":"^5.0.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/random-array-iterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/random-array-iterator/issues"},"homepage":"https://github.com/mafintosh/random-array-iterator","gitHead":"072f6d23b791975ad9dad34b0c29b87eb231c6e5","_id":"random-array-iterator@1.0.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"shasum":"1081f8922d68d2817368c13028f858ec308e146b","size":2492,"noattachment":false,"key":"/random-array-iterator/-/random-array-iterator-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/random-array-iterator/download/random-array-iterator-1.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-array-iterator_1.0.0_1606757173003_0.9088675427573221"},"_hasShrinkwrap":false,"publish_time":1606757173168,"_cnpm_publish_time":1606757173168},"0.0.0":{"name":"random-array-iterator","version":"0.0.0","description":"An iterator to iterate an array in random order with controls to requeue or dequeue elements during the iteration","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.3","tape":"^5.0.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/random-array-iterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/random-array-iterator/issues"},"homepage":"https://github.com/mafintosh/random-array-iterator","gitHead":"8a89e99411980e78c373bd21f7105d39669385b3","_id":"random-array-iterator@0.0.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"shasum":"2c7454b540fcc56a9f47d266105d346bf6f53571","size":2492,"noattachment":false,"key":"/random-array-iterator/-/random-array-iterator-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/random-array-iterator/download/random-array-iterator-0.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-array-iterator_0.0.0_1606757121198_0.12386224443762672"},"_hasShrinkwrap":false,"publish_time":1606757121313,"_cnpm_publish_time":1606757121313}},"readme":"# random-array-iterator\n\nAn iterator to iterate an array in random order with controls to requeue or dequeue\nelements during the iteration.\n\n```\nnpm install random-array-iterator\n```\n\n## Usage\n\n``` js\nconst RandomArrayIterator = require('random-array-iterator')\n\nconst ite = new RandomArrayIterator([1, 2, 3, 4, 5])\n\nfor (const val of ite) {\n  console.log(val) // random value\n\n  // call requeue if you want to revisit this value is the same iteration\n  if (someCondition) ite.requeue()\n\n  // call dequeue if you want to remove the value from the iteration and array entirely\n  if (someOtherCondition) ite.dequeue()\n}\n```\n\n## API\n\n#### `ite = new RandomArrayIterator(array)`\n\nMake a new iterator. Implements the JavaScript iterator interface.\n\n#### `ite.requeue()`\n\nRequeue the current value. Only valid to call during an iteration.\n\n#### `ite.dequeue()`\n\nRemove the current value from the array and iteration. Only valid to vall during an iteration.\n\n#### `ite.restart()`\n\nRestarts the iterator.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/random-array-iterator","bugs":{"url":"https://github.com/mafintosh/random-array-iterator/issues"},"license":"MIT"}