{"_id":"shuffled-priority-queue","_rev":"6-dab669977f330e1f9b9e2b75c3014d1d","name":"shuffled-priority-queue","description":"A priority queue that shuffles elements with the same priority.","dist-tags":{"latest":"2.1.0"},"versions":{"0.0.0":{"name":"shuffled-priority-queue","version":"0.0.0","description":"A priority queue that shuffles elements with the same priority.","main":"index.js","scripts":{"test":"standard && tape test.js"},"dependencies":{"unordered-set":"^2.0.0"},"devDependencies":{"standard":"^10.0.2","tape":"^4.6.3"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/shuffled-priority-queue.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/shuffled-priority-queue/issues"},"homepage":"https://github.com/mafintosh/shuffled-priority-queue","gitHead":"bef752205a92af23fb99f11e4c0ee90344f18802","_id":"shuffled-priority-queue@0.0.0","_shasum":"e6f8912559b32602bc05e04839d352a2c810cadd","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"e6f8912559b32602bc05e04839d352a2c810cadd","tarball":"https://registry.npmjs.org/shuffled-priority-queue/-/shuffled-priority-queue-0.0.0.tgz","integrity":"sha512-HVBRCL9R2lZ0813wRQN6DJsjqO5A5RcXVXQMOC7d9n+Rs6eZrAtGPTLyvGuAI3EIyRKOyOo5C0W5PUQ5EPK0Wg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBpp4mQDzmXnI5bhP82TFz2zRs93hfBMOwilz2nqeYjZAiBuGk2XONNcrvq+k54sjcoY3LDq822LduJbtNh+504GHQ=="}]},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/shuffled-priority-queue-0.0.0.tgz_1495898624954_0.4286853603553027"},"directories":{}},"1.0.0":{"name":"shuffled-priority-queue","version":"1.0.0","description":"A priority queue that shuffles elements with the same priority.","main":"index.js","scripts":{"test":"standard && tape test.js"},"dependencies":{"unordered-set":"^2.0.0"},"devDependencies":{"standard":"^10.0.2","tape":"^4.6.3"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/shuffled-priority-queue.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/shuffled-priority-queue/issues"},"homepage":"https://github.com/mafintosh/shuffled-priority-queue","gitHead":"0d2a8dfe9ccd15e43c3acbc7f87bcd673f86170e","_id":"shuffled-priority-queue@1.0.0","_shasum":"cabd457c45aebd2c9400e8c34aca2e7f36d7317c","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"cabd457c45aebd2c9400e8c34aca2e7f36d7317c","tarball":"https://registry.npmjs.org/shuffled-priority-queue/-/shuffled-priority-queue-1.0.0.tgz","integrity":"sha512-4Row2BGppclLUAxk/trVIOGpzMi7AnGKBdGGXuDcuj+bwG7MLJBL9hRREWopn8rJTtP2Yg1aUycpvBvBVxu2bg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEWaZo5wD3cRaCgz+IeI7pXqwI5RzdtCfvCr52cXDo7iAiEAq+NMGc/O3NbICMRKBLMt1KuXcpS/BwPyr1eyd13bQ6c="}]},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/shuffled-priority-queue-1.0.0.tgz_1495898710353_0.6647152316290885"},"directories":{}},"2.0.0":{"name":"shuffled-priority-queue","version":"2.0.0","description":"A priority queue that shuffles elements with the same priority.","main":"index.js","scripts":{"test":"standard && tape test.js"},"dependencies":{"unordered-set":"^2.0.1"},"devDependencies":{"standard":"^12.0.1","tape":"^4.9.1"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/shuffled-priority-queue.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/shuffled-priority-queue/issues"},"homepage":"https://github.com/mafintosh/shuffled-priority-queue","gitHead":"19e89d39a0bb7041f76b3f4e72e4f4a22f0e77ad","_id":"shuffled-priority-queue@2.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.11.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"integrity":"sha512-g7bQ4jXstGOzbzCeuHoNItSPWV60dYgjl9eA4GCcD2Coi282zI85JVN5mUImowLqBZc33GI3USwZrBzcQkl8Jg==","shasum":"c98bea3a4df7b0571d277f4defbb01bf497b4dc2","tarball":"https://registry.npmjs.org/shuffled-priority-queue/-/shuffled-priority-queue-2.0.0.tgz","fileCount":7,"unpackedSize":9589,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtqYMCRA9TVsSAnZWagAAMUYP/j7UW0G+iUU0MbL7yRGo\n+Z5+eiyYDb003Dj+kuCw0/cIcUGEoNshPedk56WrwOeXN26XSXyyEkqJ2g5G\n4yJ6UkP/F2EPlm81C3j7fZy+1kEwOAmm6PR66o/HhnWBlAubxTv6XPFUsTE4\nPK9SVLR0KoON2n63OFSRAb7HHmqkLp4zZE2xFFso/KXH+XTpM+HjcI4BUeQ2\nNK7mIvTpSe1QBRrJ56FPC9hUS+e4RXX4/tjuAIScTr6kL7rwjNtV3xfMi1xA\nunerXVDGMSot5vcTi1+HIVQC8pwvm0H37iI4ZMj56XxJPmRJiTP7BjusUFIx\nmsD7HAId3geh+JqP4T8SjfAO5bD+cTkh9Ad0r2ZHTDsXanMgutNfu66rV0lS\nAqayOUFz8fkqv19MbdCaHYZAdjpwuUJWGlxFj2G/z+mmWBc3yQOAeTfLXJs8\nlhO6tAdMCwIU6r0F3DvGMbFmVQh76fJ6/p2ksdSfzkyTymvgaxHI/qV/lfJ+\nPTGF9dU3ijYR10VfZJb+s0kxoAnys/fJVgkhhSb1n2Ieqprif4FOVsTPqQ6+\nbEPbN+vX7jmPIi/A1+xtUwBal7RuIwKoqhUP6lreEpxLuuQpwYOZ9NkzIyxu\nFHPXeAYcWNz+zFS5atpzFx0pmwtelMkbXSF7spCRFwwkSBQ4NNd7QM66H60k\nd8rz\r\n=4s43\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEiX9tArFlL4bd/B5rKi7bgL3d96NfJqrin9C9UFUmk2AiB31UqtDq99bneZWKw68yAV84W8F+GwgB7ldHYT6RVnWA=="}]},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/shuffled-priority-queue_2.0.0_1538696715506_0.7946886434874818"},"_hasShrinkwrap":false},"2.1.0":{"name":"shuffled-priority-queue","version":"2.1.0","description":"A priority queue that shuffles elements with the same priority.","main":"index.js","scripts":{"test":"standard && tape test.js"},"dependencies":{"unordered-set":"^2.0.1"},"devDependencies":{"standard":"^12.0.1","tape":"^4.9.1"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/shuffled-priority-queue.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/shuffled-priority-queue/issues"},"homepage":"https://github.com/mafintosh/shuffled-priority-queue","gitHead":"549955b992ff563972c3865b72ac7449bd071095","_id":"shuffled-priority-queue@2.1.0","_npmVersion":"6.2.0","_nodeVersion":"10.11.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"integrity":"sha512-xhdh7fHyMsr0m/w2kDfRJuBFRS96b9l8ZPNWGaQ+PMvnUnZ/Eh+gJJ9NsHBd7P9k0399WYlCLzsy18EaMfyadA==","shasum":"432bf14dd90f7c4dd1705752d81aadf454fd3af6","tarball":"https://registry.npmjs.org/shuffled-priority-queue/-/shuffled-priority-queue-2.1.0.tgz","fileCount":7,"unpackedSize":9930,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbt7PXCRA9TVsSAnZWagAA7GEP/ixdwv6uwUKpAZzf93tF\nftBw4ivK9C2LZyVtqRBgqHGza7TiRTbZMTq6RbtjA1eRneNYwcCnUG180fV7\naUE/D6yXTC9zkduybVEunmUb+CvuskYtji45umK6CppKd58i9Wo0Wk/1VJeG\nhTi0cC56iEyNGTG/M5Nzfn5LLNncMEAUJ5gFEmwIsSXkh5R+Ps2vYiXUf2lj\n5b2DPMS/MSGPa98Z6YBgh87AVW60f+Ho5C6eeqQzJaeJMGOAQcMB/x8eLNMU\nBBzEqX9twz2XBwXWMh31gxJHrQ7SHkO/AgPIvl0Vne8MRBHE6ZyvG0m/5zeV\nSge0jO5aeW4BF7mHKeTtqg8gOg6wp/PRWy7RCYMoSxsFpmmnDPGofXZ4+V+9\nVNagifilP0Z+Oqa/er5Cb0Q9v9Gxk8OeJ2e0fCPdgIDV88KR/QVs8EVTi3hx\nB5LOS8/xjMvOM+6bm+hTsyu1xI9dUMdHtJ2CmT6u0/Cwl8WD6NDkQ4kMnvTp\n0Roh1kNkSJtSK/a+2BpW7cj8uindWvnK9oKzpTvm85Uqpi+/zej8/lXSbKzU\n8rNJIf1dhDBCUfp77C16zaB0gWREC6XObnlzyD9ClV0bvE7O8eEApnZ/Sw81\n2PZ3ZUlH0xti4XBBxWO+hbms2QzGlA9HVP3618BAw/I93TKvUFHe6acupBBG\n8L/a\r\n=L+/n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC2FUswsu16l6XJz5GxFKzzTezwfKETQHLXlgLOPfBR4AiAnE/8P3F813qpP49TP8BoP41xXCbRCPdHJGBukUY4pTw=="}]},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/shuffled-priority-queue_2.1.0_1538765782373_0.7226369420474545"},"_hasShrinkwrap":false}},"readme":"# shuffled-priority-queue\n\nA priority queue that shuffles elements with the same priority.\n\n```\nnpm install shuffled-priority-queue\n```\n\n[![Build Status](https://travis-ci.org/mafintosh/shuffled-priority-queue.svg?branch=master)](https://travis-ci.org/mafintosh/shuffled-priority-queue)\n\n## Usage\n\n``` js\nconst spq = require('shuffled-priority-queue')\nconst queue = spq()\n\nqueue.add({\n  priority: 0,\n  value: 'hello'\n})\n\nqueue.add({\n  priority: 0,\n  value: 'world'\n})\n\nqueue.add({\n  priority: 1,\n  value: 'welt'\n})\n\nqueue.add({\n  priority: 2,\n  value: 'verden'\n})\n\nconsole.log(queue.shift()) // returns {value: 'verden'}\nconsole.log(queue.shift()) // returns {value: 'welt'}\nconsole.log(queue.shift()) // returns {value: 'hello'} or {value: 'world'}\nconsole.log(queue.shift()) // returns {value: 'hello'} or {value: 'world'}\nconsole.log(queue.shift()) // returns null (empty queue)\n```\n\n## API\n\n#### `const queue = spq()`\n\nCreate a new queue.\n\n#### `value = queue.add(value)`\n\nAdd a new value to the queue. The value is returned for convenience\nIf you set `value.priority` to a number, it'll be added to the queue at that priority.\n\n#### `queue.remove(value)`\n\nRemove a value from the queue.\n\n#### `bool = queue.has(value)`\n\nCheck if a value is in the queue.\n\n#### `value = queue.shift()`\n\nShift the next value off the queue.\n\nThe value returned will have the highest priority off the queue.\nIf multiple values have the same priority a random one is returned.\n\n#### `value = queue.head()`\n\nSame as `shift()` but does not mutate the queue.\n\n#### `value = queue.pop()`\n\nSame as `shift()` but returns a value with the lowest priority.\n\n#### `value = queue.tail()`\n\nSame as `pop()` but does not mutate the queue.\n\n#### `queue.length`\n\nProperty containing how many items are in the queue\n\n#### `for (const value of queue)`\n\nIterate the queue from highest priority to lowest using the `for of` syntax\n\n#### `value = queue.next([prevValue])`\n\nIterate the queue from highest priority to lowest.\n\n``` js\nlet prevValue = null\n\nwhile (prevValue = queue.next(prevValue)) {\n  console.log('value:', prevValue)\n}\n```\n\n#### `value = queue.prev([prevValue])`\n\nIterate the queue from lowest priority to highest.\n\n``` js\nlet prevValue = null\n\nwhile (prevValue = queue.prev(prevValue)) {\n  console.log('value:', prevValue)\n}\n```\n\n## License\n\nMIT\n","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"time":{"modified":"2022-06-26T19:12:10.647Z","created":"2017-05-27T15:23:45.886Z","0.0.0":"2017-05-27T15:23:45.886Z","1.0.0":"2017-05-27T15:25:11.285Z","2.0.0":"2018-10-04T23:45:15.685Z","2.1.0":"2018-10-05T18:56:22.497Z"},"homepage":"https://github.com/mafintosh/shuffled-priority-queue","repository":{"type":"git","url":"git+https://github.com/mafintosh/shuffled-priority-queue.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"bugs":{"url":"https://github.com/mafintosh/shuffled-priority-queue/issues"},"license":"MIT","readmeFilename":"README.md"}