{"_id":"hypertrie-stack-iterator","_rev":"1-2d5bab0fa337aa955f1e58363921686b","name":"hypertrie-stack-iterator","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"hypertrie-stack-iterator","version":"1.0.0","description":"A stack-based iterator for iterating over multiple Hypertries","main":"index.js","scripts":{"test":"standard && tape test/*.js"},"repository":{"type":"git","url":"git+https://github.com/andrewosh/hypertrie-stack-iterator.git"},"keywords":["hypertrie","iterator"],"author":{"name":"Andrew Osheroff","email":"andrewosh@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/andrewosh/hypertrie-stack-iterator/issues"},"homepage":"https://github.com/andrewosh/hypertrie-stack-iterator#readme","devDependencies":{"nanoiterator":"^1.2.0","standard":"^14.3.1","tape":"^4.11.0"},"gitHead":"e15fdc08509d98d6b6a5ed3b795033a0665cbc75","_id":"hypertrie-stack-iterator@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"andrewosh","email":"andrewosh@gmail.com"},"dist":{"integrity":"sha512-D4i1Dus5Y+hMrHAt1xSo72hN2I5EDOixFVlbuegWBGL7Mi2yUNucLkxssYqCZ7LOs5StO/Hqo44MT0qgzlmjyA==","shasum":"593703084973e5e1a3e98b1fbc8dcc0674f935d5","tarball":"https://registry.npmjs.org/hypertrie-stack-iterator/-/hypertrie-stack-iterator-1.0.0.tgz","fileCount":6,"unpackedSize":8264,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdihroCRA9TVsSAnZWagAAd/oQAIN0LdREezuJqcRAhQ6h\nPXrlp4bfX0MsB67CqnjN+czP79oEl/ygnyYcbQiRF2bSI9r0i9uGHluVPfBI\nVX6hvzEk7sMgXESUiakHffGlVzuBLmfmWj1/eFdrQ8cF5TjA+zvm+LV5nXfd\nNvjC0UJUBbEcBw/1BTvNYHZSjPTRf8pDXkf3XFAhYM+8fNWOaJGNiPBEPxEX\nAZG4Ud25l4hgxJYRRZd1etXjgCTj8qpN08y+WsqFkBgKLYjpfz1d7EM3qpOB\n1fiLUqCX8Gd41sQ+0W7JwSqqrCuTvB4xpgh39zGyNjTUL1uObstgawKi/1rX\nqQWseT9LBycLtMnfmWuZaQ67HBU3YOdGGPSg2/o0nt5au9S309KmD+WMOkgN\nC5SKjhmg9GEaV8K9iB/tRfa0n7h/0ELPvG/8Pf0COWzryHJkhynv9vaqjEhz\nbQ00jhjN0YE/ZSGhpCWDypUuBlHsEdNDl/ZNS6MXnP57PfXpD76dB/n+lwk3\nCsri+5rPA1Qgn4AACzCYiTvN+SOyjT4eW+h6uUZlwtX7z2cmrjUl/XDPQYfs\nWUUuCJsRgz+e9KHZuPJljutJebdrFFbUM0n8WSmsQFld0/ajKIbN9xTwLBmd\nm3QWI4o5/NDU84ALk4AD0MHis8T13Z+LrHxuuEPjaBE6UyZx7WCY5aTMQKn/\nwdgK\r\n=wiHG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICExwW2ygkWj5qE+jZ86eBPPADQW9S6E7wKKgwc0QmmUAiEAlF4EnOVuaOa1ieMTVm5gasdn+hbUjIh5VthVdQEeYDc="}]},"maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypertrie-stack-iterator_1.0.0_1569331943957_0.5725361251289209"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-24T13:32:23.957Z","1.0.0":"2019-09-24T13:32:24.143Z","modified":"2022-05-05T12:50:14.795Z"},"maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"description":"A stack-based iterator for iterating over multiple Hypertries","homepage":"https://github.com/andrewosh/hypertrie-stack-iterator#readme","keywords":["hypertrie","iterator"],"repository":{"type":"git","url":"git+https://github.com/andrewosh/hypertrie-stack-iterator.git"},"author":{"name":"Andrew Osheroff","email":"andrewosh@gmail.com"},"bugs":{"url":"https://github.com/andrewosh/hypertrie-stack-iterator/issues"},"license":"MIT","readme":"# hypertrie-stack-iterator\n[![Build Status](https://travis-ci.com/andrewosh/hypertrie-stack-iterator.svg?token=WgJmQm3Kc6qzq1pzYrkx&branch=master)](https://travis-ci.com/andrewosh/hypertrie-stack-iterator)\n\nA stack-based iterator for iterating over multiple Hypertries.\n\nThe stack iterator provides push and pop hooks, as well as a map function for modifying return values based on what's currently on the stack. Push operations can also tag iterators with state that can be accessed during `map`.\n\n### Installation\n```\nnpm i hypertrie-stack-iterator --save\n```\n### Usage\n```js\nconst StackIterator = require('hypertrie-stack-iterator')\nconst ite = new StackIterator({\n  maxDepth: ...,\n  onpush: ...,\n  onpop: ...,\n  map: ...\n})\nite.push(iterator1)\nite.push(iterator2)\n// Reading values from `ite` will now return the values from iterator2 then iterator1\n```\n### API\n#### `const ite = new StackIterator([opts])`\nCreates a new StackIterator.\n\nOptions can include:\n```js\n{\n  maxDepth: -1, // The maximum stack depth (-1 means infinite),\n  onpush: function (iterator, state) { ... } // Called when a new iterator/state pair is pushed.\n  onpop: function (iterator, state) { ... } // Called when an iterator/state pair is popped.\n  map: function (value, states) { ... } // Called before a value is about to be returned.\n}\n```\n`onpush` and `onpop` are synchronous, but can modify the StackIterator by pushing new values onto the stack.\n`map` is called with both the value that's about to be returned, and an array of the state values that you've associated with stack entries, in stack order.\n\n#### `ite.push(iterator, state)`\nInsert a new iterator/state pair into the stack.\n\n#### `ite.next(cb)`\nYield the next value in the iterator. Follows the [nanoiterator](https://github.com/mafintosh/nanoiterator) callback format.\n\n#### `ite.destroy(cb`\nDestroys the iterator. This will destroy all iterators currently on the stack.\n\n### License\nMIT\n\n\n","readmeFilename":"README.md"}