{"_id":"nanoiterator","_rev":"235505","name":"nanoiterator","description":"Lightweight and efficient iterators","dist-tags":{"latest":"1.2.1"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2023-03-24T16:23:18.000Z","created":"2018-01-27T11:41:57.481Z","1.2.1":"2020-01-21T14:46:02.273Z","1.2.0":"2018-05-26T18:43:21.784Z","1.1.0":"2018-04-12T19:19:24.851Z","1.0.1":"2018-03-19T20:48:53.694Z","1.0.0":"2018-01-27T11:41:57.481Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"versions":{"1.2.1":{"name":"nanoiterator","version":"1.2.1","description":"Lightweight and efficient iterators","main":"index.js","dependencies":{"inherits":"^2.0.3","readable-stream":"^2.3.3"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"homepage":"https://github.com/mafintosh/nanoiterator","gitHead":"85b44bf3e162ecd176152e7d5c6b39c2b3a807b9","_id":"nanoiterator@1.2.1","_nodeVersion":"13.6.0","_npmVersion":"6.13.4","dist":{"shasum":"920369761ad958e1c5d0b516bf575a625e1d9254","size":4058,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.2.1.tgz","tarball":"http://name.csiicloud.com:7001/nanoiterator/download/nanoiterator-1.2.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator_1.2.1_1579617962164_0.5472190873132479"},"_hasShrinkwrap":false,"publish_time":1579617962273,"_cnpm_publish_time":1579617962273,"_cnpmcore_publish_time":"2021-12-16T23:46:28.017Z"},"1.2.0":{"name":"nanoiterator","version":"1.2.0","description":"Lightweight and efficient iterators","main":"index.js","dependencies":{"inherits":"^2.0.3","readable-stream":"^2.3.3"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"homepage":"https://github.com/mafintosh/nanoiterator","gitHead":"cfe160f33fcbb7954b05df5b0553286eaf156224","_id":"nanoiterator@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"36461e246f9c52e591d8a097cea5886faec9f6af","size":4055,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.2.0.tgz","tarball":"http://name.csiicloud.com:7001/nanoiterator/download/nanoiterator-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator_1.2.0_1527360201718_0.9545309104441586"},"_hasShrinkwrap":false,"publish_time":1527360201784,"_cnpm_publish_time":1527360201784,"_cnpmcore_publish_time":"2021-12-16T23:46:28.240Z"},"1.1.0":{"name":"nanoiterator","version":"1.1.0","description":"Lightweight and efficient iterators","main":"index.js","dependencies":{"inherits":"^2.0.3","readable-stream":"^2.3.3"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"homepage":"https://github.com/mafintosh/nanoiterator","gitHead":"100a2588e9188a930ebc597629e7b1d88abec2cf","_id":"nanoiterator@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"612b0247a8a08daac290dae7112ce092f8614a18","size":3910,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/nanoiterator/download/nanoiterator-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator_1.1.0_1523560764765_0.9134125498039052"},"_hasShrinkwrap":false,"publish_time":1523560764851,"_cnpm_publish_time":1523560764851,"_cnpmcore_publish_time":"2021-12-16T23:46:28.441Z"},"1.0.1":{"name":"nanoiterator","version":"1.0.1","description":"Lightweight and efficient iterators","main":"index.js","dependencies":{"inherits":"^2.0.3","readable-stream":"^2.3.3"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"homepage":"https://github.com/mafintosh/nanoiterator","gitHead":"753c5787d8ee6ba3b0e6fbc640bfc98ff6185b7e","_id":"nanoiterator@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"b7479449501e901d6a4cf4493beba69d2a901112","size":3791,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/nanoiterator/download/nanoiterator-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator_1.0.1_1521492533611_0.25367152215978406"},"_hasShrinkwrap":false,"publish_time":1521492533694,"_cnpm_publish_time":1521492533694,"_cnpmcore_publish_time":"2021-12-16T23:46:28.627Z"},"1.0.0":{"name":"nanoiterator","version":"1.0.0","description":"Lightweight and efficient iterators","main":"index.js","dependencies":{"inherits":"^2.0.3","readable-stream":"^2.3.3"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoiterator.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"homepage":"https://github.com/mafintosh/nanoiterator","gitHead":"c0f965065e6b02b839a8d6ef89991225a859f840","_id":"nanoiterator@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"954969b3a92962aac956eea7d23d6893586cc4ac","size":3729,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/nanoiterator/download/nanoiterator-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator-1.0.0.tgz_1517053316630_0.548198827309534"},"directories":{},"publish_time":1517053317481,"_hasShrinkwrap":false,"_cnpm_publish_time":1517053317481,"_cnpmcore_publish_time":"2021-12-16T23:46:28.835Z"}},"readme":"# nanoiterator\n\nLightweight and efficient iterators\n\n```\nnpm install nanoiterator\n```\n\n[![build status](https://travis-ci.org/mafintosh/nanoiterator.svg?branch=master)](https://travis-ci.org/mafintosh/nanoiterator)\n\n## Usage\n\n``` js\nvar nanoiterator = require('nanoiterator')\n\nvar values = [1, 2, 3, 4, null]\nvar ite = nanoiterator({\n  next: cb => process.nextTick(cb, null, values.shift())\n})\n\nite.next(console.log) // 1\nite.next(console.log) // 2\nite.next(console.log) // 3\nite.next(console.log) // 4\nite.next(console.log) // null\n```\n\n## API\n\n#### `var ite = nanoiterator([options])`\n\nCreate a new iterator.\n\nOptions include:\n\n``` js\n{\n  open: cb => cb(null), // sets ._open\n  next: cb => cb(null, nextValue), // sets ._next\n  destroy: cb => cb(null) // sets ._destroy\n}\n```\n\n#### `ite.next(callback)`\n\nCall this function to get the next value from the iterator. It is same to call this\nmethod as many times as you want without waiting for previous calls to finish.\n\n#### `ite._next(callback)`\n\nOverwrite this function to your own iteration logic.\n\nCall `callback(null, nextValue)` when you have a new value to return, or\ncall `callback(null, null)` if you want to signal that the iterator has ended.\n\nNo matter how many times a user calls `.next(cb)` only *one* `_next` call will\nrun at the same time.\n\n#### `ite._open(callback)`\n\nOptionally overwrite this method with your own open logic.\n\nCalled the first time `._next` is called and is run before the `_next` call runs.\n\n#### `ite._destroy(callback)`\n\nOptionally overwrite this method with your own destruction logic.\n\nCalled once when a user calls `.destroy(cb)` and all subsequent `.next()` calls\nwill result in an error.\n\n#### `ite.ended`\n\nSignals if the iterator has been ended (`_next` has returned `(null, null)`).\n\n#### `ite.opened`\n\nSignals if the iterator has been fully opened.\n\n#### `ite.closed`\n\nSignals if the iterator has been destroyed.\n\n## Iterator to Node.js Stream\n\nIf you want to convert the iterator to a readable Node.js stream you can use the\n`require('nanoiterator/to-stream')` helper.\n\n``` js\nvar toStream = require('nanoiterator/to-stream')\nvar stream = toStream(iterator)\n\nstream.on('data', function (data) {\n  // calls .next() behind the scene and pushes it to the stream.\n})\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/nanoiterator","bugs":{"url":"https://github.com/mafintosh/nanoiterator/issues"},"license":"MIT"}