{"_id":"@anandsuresh/smart-queue","_rev":"3-6508733ef136e8ef569557ad5814fdd3","name":"@anandsuresh/smart-queue","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@anandsuresh/smart-queue","version":"1.0.0","description":"A smart queue implementation","license":"MIT","main":"lib/smart-queue.js","repository":{"type":"git","url":"git+https://github.com/anandsuresh/smart-queue.git"},"author":{"name":"Anand Suresh"},"bugs":{"url":"https://github.com/anandsuresh/smart-queue/issues"},"homepage":"https://github.com/anandsuresh/smart-queue#readme","scripts":{"coverage":"NODE_ENV=test istanbul cover -i 'lib/**/*.js' _mocha -- --ui bdd --reporter spec --recursive spec && open coverage/lcov-report/index.html > /dev/null 2>&1","lint":"standard","test":"mocha --ui bdd --reporter spec --recursive spec"},"devDependencies":{"chai":"4.1.2","istanbul":"1.1.0-alpha.1","mocha":"5.0.5","sinon":"5.0.0","standard":"11.0.1"},"standard":{"ignore":[],"globals":["after","afterEach","before","beforeEach","describe","it"]},"gitHead":"65f33c904166032aef7b16df084a0d5e2b610c4b","_id":"@anandsuresh/smart-queue@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"anandsuresh","email":"anandsuresh@gmail.com"},"dist":{"integrity":"sha512-Hlc0NmT08+UhFQfw6vtXSquZs1ZXYLvjjItgZGeAAjnonA/6j1xvF1B2HoAltQFoblJdxm9MvOA7v5GGBWu6+A==","shasum":"58c4dd85949a37b4732952629b36ab56102c6399","tarball":"https://registry.npmjs.org/@anandsuresh/smart-queue/-/smart-queue-1.0.0.tgz","fileCount":5,"unpackedSize":10491,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBVyWuTwEzlFY7v5S7leV695QDjnMvAXk8cjwynCaNuRAiAYFKWlho1XWctFQf79jP1fZPmP/eyJTt2Iy3BsF11gyA=="}]},"maintainers":[{"name":"anandsuresh","email":"anandsuresh@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/smart-queue_1.0.0_1522104738768_0.4392606549459701"},"_hasShrinkwrap":false},"1.0.1":{"name":"@anandsuresh/smart-queue","version":"1.0.1","description":"A smart queue implementation","license":"MIT","main":"lib/smart_queue.js","repository":{"type":"git","url":"git+https://github.com/anandsuresh/smart-queue.git"},"author":{"name":"Anand Suresh"},"bugs":{"url":"https://github.com/anandsuresh/smart-queue/issues"},"homepage":"https://github.com/anandsuresh/smart-queue#readme","scripts":{"coverage":"NODE_ENV=test istanbul cover -i 'lib/**/*.js' _mocha -- --ui bdd --reporter spec --recursive spec && open coverage/lcov-report/index.html > /dev/null 2>&1","lint":"standard","test":"mocha --ui bdd --reporter spec --recursive spec"},"devDependencies":{"chai":"4.1.2","istanbul":"1.1.0-alpha.1","mocha":"5.0.5","sinon":"5.0.0","standard":"11.0.1"},"standard":{"ignore":[],"globals":["after","afterEach","before","beforeEach","describe","it"]},"gitHead":"5bd030952d026dd76a7e3bb0552d9cedc919a854","_id":"@anandsuresh/smart-queue@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"anandsuresh","email":"anandsuresh@gmail.com"},"dist":{"integrity":"sha512-5bzSqtvfuZXplH84olfWIipVAeAZhM+KjqivdqWkdKcPXX+qFzhlVIR28+BffIZwk0/buLQZ8m/P2xJF326n8Q==","shasum":"7abf79da766ffe88e1195648196d6ebdd8a94fd4","tarball":"https://registry.npmjs.org/@anandsuresh/smart-queue/-/smart-queue-1.0.1.tgz","fileCount":5,"unpackedSize":10497,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjC7NVwlJjDlCz2Y1UkDqJVAWkul7Gt7louU5nbCf4XgIhAP8ro+QCNibntw/ko/9Y/ygfZIFrx62nWJUsiIbKeq2Z"}]},"maintainers":[{"name":"anandsuresh","email":"anandsuresh@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/smart-queue_1.0.1_1522113862764_0.6108840052197837"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-26T22:52:18.715Z","1.0.0":"2018-03-26T22:52:18.878Z","modified":"2022-04-04T13:55:15.753Z","1.0.1":"2018-03-27T01:24:22.888Z"},"maintainers":[{"name":"anandsuresh","email":"anandsuresh@gmail.com"}],"description":"A smart queue implementation","homepage":"https://github.com/anandsuresh/smart-queue#readme","repository":{"type":"git","url":"git+https://github.com/anandsuresh/smart-queue.git"},"author":{"name":"Anand Suresh"},"bugs":{"url":"https://github.com/anandsuresh/smart-queue/issues"},"license":"MIT","readme":"# smart-queue\n\nA smart queue provides the abstraction of a queue that can operate in the following modes:\n- `drop`: a fixed-size queue that drops new elements when the queue is full\n- `overwrite`: a fixed-size queue that overwrites old elements when the queue is full\n- `grow`: a queue that grows in size to accommodate more elements\n\n## usage\n\n```\nconst {create} = require('smart-queue')\nconst dropQueue = create({size: 100, strategy: 'drop'})\nconst overwriteQueue = create({size: 100, strategy: 'overwrite'})\nconst growQueue = create({size: 100, strategy: 'overwrite'})\n\nfor (let i = 0; i < 100; i++) {\n  assert(dropQueue.enqueue(i))\n  assert(overwriteQueue.enqueue(i))\n  assert(growQueue.enqueue(i))\n}\n\n// A drop-strategy queue will fail to enqueue items when the queue is full\nassert(dropQueue.enqueue(101) === false)\nassert(dropQueue.dequeue() === 0)\n\n// An overwrite-strategy queue will succeed in enqueuing items when the queue is full, but will\nassert(overwriteQueue.enqueue(101) === true)\nassert(overwriteQueue.dequeue() === 1)\n\n// A grow-strategy queue will continue to enqueue items as long as memory is available\nassert(overwriteQueue.enqueue(101) === true)\nassert(overwriteQueue.dequeue() === 0)\n```\n","readmeFilename":"README.md"}