{"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":{"integrity":"sha512-M7V9cvfDErMg/H3j90zIGY7Fq3vIGjnnNXwcZ/EXO4plZT3dGNwvykfslHgtbJ8prOGuu3khmc87pND0jdmkcA==","shasum":"920369761ad958e1c5d0b516bf575a625e1d9254","tarball":"http://registry-npm.ywwl.com/nanoiterator/download/nanoiterator-1.2.1.tgz","fileCount":8,"unpackedSize":14877,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeJw6qCRA9TVsSAnZWagAAV/0P/itkhkhJJ2CFoa9NlcWl\nV9JVzsS1pkqLJIsFZvecL2+3BH+NI99d0zpAgZgk8aAhQU+FJMUrv0cwfUrw\ncwQxu2ILeE0h32cwdN56fJ3pp9zkm3QgpWUVE4IolnhT1iSnBgEF2CjedtQE\nIN8SMhWwyP1YSuXR5mir2irrOGN1kGOkqRexxfN8MAup42A6bBwUn7ISpPzj\n6kdCmrFhLaQoaubyxaWfZir0Mw2tmr3ONYGRf4eqxcNoG8wd91lZvHVUsp8q\n61qNlFnBZ2xYiTIJiOgJ+qot6YAgtKzvdPNZyczykjqs5B14rcZiv3hlMxLG\nIWZgBhWk84d+m3fUh0tjsUms8NU4hpW9d4qEnJFBLej04y3HGP8ZgZUU7M35\nxNOKIdHVzF4D9FNvsO1xaZdZNAiTaK7UF/Zf81v05agfwcA+E3PXJWuzHIEA\nKYv/jtACspnseNaWvQJcGTJY4D2zzao2Nz1/K2Hc5Wy4vB81w9C2mS7RU1c9\nH64/rCyezm52M0LaiNFzaC5OeE0stwXxKi6Md6U4yWwXwm1/bM/mwFLEUDD9\nHrtpou62o6WcJfyUiVCTfSRDH/eQLeh5WBag3rrWuwOuTNGnebX5Iwp3PFmX\n6vU3Dblg6EC6d8tYFWdVWK1/+zvdUobQzUwCBG+qG/HmTMg1vQbN2LBWcB3V\nmvBG\r\n=Yt4Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCg8bU2BO2zWO4kGVvhQ/A1/dbuwbwiioJad4Q/UKIBjgIhAItKNOr8t0EDl8Fys0zjqmHASvECoAysx8NXHk2Qw3i0"}],"size":4058,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.2.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_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,"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","publish_time":1579617962273,"_cnpm_publish_time":1579617962273,"dist-tags":{"latest":"1.2.1"}}