{"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":{"integrity":"sha512-RO7dQQZx3Y/qbaqZbsSuf/wITgdmbdd8DR73xrH11Mi+fcwJc3q7RvrsxwLN3MO9E7Wjd20vkAyRuYHgZ2VzzQ==","shasum":"954969b3a92962aac956eea7d23d6893586cc4ac","tarball":"http://registry-npm.ywwl.com/nanoiterator/download/nanoiterator-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID+eHmt8sjBZ4Iwt1d835M7pbKCH9U9KWaCVXZY47R5qAiAHCTYDmgmvtv18PVUsphcPYD7jJeMxapPDVcB8r0r59g=="}],"size":3729,"noattachment":false,"key":"/nanoiterator/-/nanoiterator-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoiterator-1.0.0.tgz_1517053316630_0.548198827309534"},"directories":{},"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":1517053317481,"_cnpm_publish_time":1517053317481,"dist-tags":{"latest":"1.2.1"}}