{"_id":"ringbufferjs","_rev":"9-5b947ebe7cb7fcca6554cf266c43f21c","name":"ringbufferjs","description":"a simple ring buffer data structure","dist-tags":{"latest":"2.0.0"},"versions":{"0.0.1":{"name":"ringbufferjs","version":"0.0.1","description":"a simple ring buffer data structure","author":{"name":"Jano González","email":"info@janogonzalez.com"},"devDependencies":{"mocha":"*","expect.js":"*"},"main":"index.js","dependencies":{},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/janogonzalez/ringbufferjs.git"},"keywords":["ring","buffer","circular","queue","ring buffer","circular buffer","data structure"],"license":"MIT","_id":"ringbufferjs@0.0.1","dist":{"shasum":"e9a6ad5323fcd8607f8aaba8c1c469916b9bcd55","tarball":"https://registry.npmjs.org/ringbufferjs/-/ringbufferjs-0.0.1.tgz","integrity":"sha512-YlhudkckZ4yix71gy0ql/tSe+xXHMowroJr6bHaG7VbC2olQnnmyCHsSHShsT+UwyqJ69UOs0q3se5X3hsHeGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICrNI4/ttLS/O0FiDuNKQ9jBaAC3UeAvrFGX6FLwYKBVAiBbzg/ZPxG/O8p6J3UUDTetY9OW/HL2RaHmosdrI5/aWg=="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"janogonzalez","email":"info@janogonzalez.com"},"maintainers":[{"name":"janogonzalez","email":"info@janogonzalez.com"}],"directories":{}},"1.0.0":{"name":"ringbufferjs","version":"1.0.0","description":"a simple ring buffer data structure","author":{"name":"Jano González","email":"info@janogonzalez.com"},"devDependencies":{"mocha":"*","expect.js":"*"},"main":"index.js","dependencies":{},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/janogonzalez/ringbufferjs.git"},"keywords":["ring","buffer","circular","queue","ring buffer","circular buffer","data structure"],"license":"MIT","gitHead":"3e30ff2f72642669b5df3e5cef10b7df10af10c5","bugs":{"url":"https://github.com/janogonzalez/ringbufferjs/issues"},"homepage":"https://github.com/janogonzalez/ringbufferjs#readme","_id":"ringbufferjs@1.0.0","_shasum":"793e795c81f2fe2b1fa441af270f51a065f3be8b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"janogonzalez","email":"info@janogonzalez.com"},"maintainers":[{"name":"janogonzalez","email":"info@janogonzalez.com"}],"dist":{"shasum":"793e795c81f2fe2b1fa441af270f51a065f3be8b","tarball":"https://registry.npmjs.org/ringbufferjs/-/ringbufferjs-1.0.0.tgz","integrity":"sha512-gJ9AqqrIXDCMp3pXD9zqnDhlt0ExxQNJvol10iixnVjwdv0Rksve1wP6/qkyzlPkCcEoFPAdl9AIxzT2BB9PHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKe6D98DJGa1UStxPhlAMiMDbR2aZQ+MdzlyVwi14wfgIgcUbSuUN2QD9yEHOCIvIUZsiX5xsWGe9JwnKT/iqIm5Q="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ringbufferjs-1.0.0.tgz_1493902187011_0.7508348086848855"},"directories":{}},"1.1.0":{"name":"ringbufferjs","version":"1.1.0","description":"a simple ring buffer data structure","author":{"name":"Jano González","email":"info@janogonzalez.com"},"devDependencies":{"mocha":"*","expect.js":"*"},"main":"index.js","dependencies":{},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/janogonzalez/ringbufferjs.git"},"keywords":["ring","buffer","circular","queue","ring buffer","circular buffer","data structure"],"license":"MIT","gitHead":"08310d5b03ec3184b08c3e6d4601b0ae63279f92","bugs":{"url":"https://github.com/janogonzalez/ringbufferjs/issues"},"homepage":"https://github.com/janogonzalez/ringbufferjs#readme","_id":"ringbufferjs@1.1.0","_npmVersion":"5.4.1","_nodeVersion":"8.4.0","_npmUser":{"name":"janogonzalez","email":"info@janogonzalez.com"},"maintainers":[{"name":"janogonzalez","email":"info@janogonzalez.com"}],"dist":{"integrity":"sha512-Hd1Z8xyaQLhdKtmbOuRCwCT9rKYk7SwUXENsA9pSAj6Jv4otUh7IwOlEhj0xu/xcP7hosMnmE7AYaVp6m8MCPQ==","shasum":"83f78108cf5dd95d2f3ab4a84352ad15829721d3","tarball":"https://registry.npmjs.org/ringbufferjs/-/ringbufferjs-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHrbhOjXaGys25IqOlah2zFOHIMBGzEROybUPTfwBjt8AiEAnu7fm083altM+XW+tw/Ms+HbxkUnjp4X9QYJwM/tS9o="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ringbufferjs-1.1.0.tgz_1505143934522_0.6105553477536887"},"directories":{}},"2.0.0":{"name":"ringbufferjs","version":"2.0.0","description":"a simple ring buffer data structure","keywords":["ring","buffer","circular","queue","ring buffer","circular buffer","data structure"],"homepage":"https://github.com/janogonzalez/ringbufferjs","bugs":{"url":"https://github.com/janogonzalez/ringbufferjs/issues"},"license":"MIT","author":{"name":"Jano González","email":"info@janogonzalez.com","url":"http://janogonzalez.com"},"main":"index.js","repository":{"type":"git","url":"git://github.com/janogonzalez/ringbufferjs.git"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*","expect.js":"*"},"gitHead":"388be6a76f55635a14fadeb22c6d02db03e94117","_id":"ringbufferjs@2.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-GCOqTzUsTHF7nrqcgtNGAFotXztLgiePpIDpyWZ7R5I02tmfJWV+/yuJc//Hlsd8G+WzI1t/dc2y/w2imDZdog==","shasum":"09f40e2675a99cfef430b7ec5815ac1bc2e24120","tarball":"https://registry.npmjs.org/ringbufferjs/-/ringbufferjs-2.0.0.tgz","fileCount":6,"unpackedSize":12583,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJetF1OCRA9TVsSAnZWagAADvkP/2V9NaTqR8I45gFA0SF/\nsyc8/3vb2mNJ+Hjx8YPwYtgr/wEsXN44RbDF5Ypo46y3/+nBidIcwtdzBqEz\noUQjgAI9WNQrPa8CJCKcBZ+yRT4Uzdh+Mnbc3mGgK9DMCJ90uRKDJLK5gvj+\nM8zLLVYuRsZvfbgNAl/qzwSZaLmLwEdsO4gtmzXNlgIhkOdFLYsT5eCAeYNa\nq2v9grLSS3s3gFVzDdz1sEdQ+9ZcRtMEWSXXayMWUgj1VGVJMNYp7l+/4g2x\nlQN8foFE+GG1XlhKfX7MRs1Hrxl04Cb/Xt9kFDnffGZ3IkeJmywgNMeiHDzc\nTa6Ste1iKXNDlZ4LFLrZUlPplapJDMmCDWxULiXU5T7Bcnjghn3PA1JDqDfF\nmEUfCPocy1mAMfEGnohbOrb8DxHZvwewnkCx6O9EzyHfH7U0ZJaE8HsN4cWI\nkTv6i2wyWT5bF+htI7znag46d1RFyVC8B057Uu2OJFqfwZZGjeUon/98Np92\nU53dKRywJAhs54mzlu0MBPOJm1llJSelrD/wYNhoMVnUmpR4XF6NsUEjqMgC\n3vc3z3lJp+eZYEsBdmWBK9RCaqYtwQS8hLos+82SmnZiZfxWYpd5HzGaPFP7\n256NysNDF36q7sffvdHQA8B7gxjskZ8Mwx6BAKld38xYfZepQ4WY0RFEDVyo\nmOV8\r\n=61h4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE9CQoPlPgpiRfbEI9t/f3j14mQlikpjs/vbVtgx3sK+AiEAgwj04uthiZrAwqrJlKsvF0QWeOt5nURTDytRv/Uo92g="}]},"maintainers":[{"name":"janogonzalez","email":"info@janogonzalez.com"}],"_npmUser":{"name":"janogonzalez","email":"info@janogonzalez.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ringbufferjs_2.0.0_1588878669620_0.11012816506947476"},"_hasShrinkwrap":false}},"readme":"# ringbuffer.js\n\n[![Build Status](https://travis-ci.com/janogonzalez/ringbufferjs.svg?branch=master)](\n  https://travis-ci.com/janogonzalez/ringbufferjs)\n\nA simple ring buffer data structure for Node.js.\n\n## Installation\n\n```\n$ npm install ringbufferjs\n```\n\n## Example\n\n```js\nvar RingBuffer = require('ringbufferjs');\n\nvar ring = new RingBuffer(2);\n\nring.enq(10);\nring.enq(5);\nring.enq(1); // 10 will be discarded\nring.size(); // 2\nring.peek(); // 5\nring.deq(); // 5\nring.size(); // 1\n```\n\n## API\n\n### `RingBuffer()`\n\nInitializes a new empty `RingBuffer` with the default capacity (50).\n\n### `RingBuffer(capacity)`\n\nInitializes a new empty `RingBuffer` with the given `capacity`.\n\n### `RingBuffer(capacity, evictedCb)`\n\nInitializes a new empty `RingBuffer` with the given `capacity` which will\nexecute the provided `evictedCb` when an element is evicted.\n\n### `RingBuffer#capacity()`\n\nReturns the capacity of the ring buffer.\n\n### `RingBuffer#deq()`\n\nDequeues the top element of the ring buffer.\nThrows an `Error` when the buffer is empty.\n\n### `RingBuffer#deqN(count)`\n\nDequeues `count` elements from the top of the ring buffer and returns them.\nThrows an `Error` if there are not enough elements in the buffer.\n\n### `RingBuffer#enq(element)`\n\nEnqueues the `element` at the end of the ring buffer and returns its new size.\nWhen the buffer is full the oldest element is discarded.\n\n### `RingBuffer#isEmpty()`\n\nReturns whether the ring buffer is empty or not.\n\n### `RingBuffer#isFull()`\n\nReturns whether the ring buffer is full or not.\n\n### `RingBuffer#peek()`\n\nPeeks at the top element of the ring buffer.\nThrows an `Error` when the buffer is empty.\n\n### `RingBuffer#peekN(count)`\n\nReturns `count` elements from the top of the ring buffer.\nThrows an `Error` if there are not enough elements in the buffer.\n\n### `RingBuffer#size()`\n\nReturns the size of the ring buffer.\n\n## Testing\n\n```\n$ npm install\n$ npm test\n```\n\n## Licence\n\nMIT\n","maintainers":[{"name":"janogonzalez","email":"info@janogonzalez.com"}],"time":{"modified":"2022-06-26T13:19:35.342Z","created":"2013-03-04T21:53:42.022Z","0.0.1":"2013-03-04T21:53:43.841Z","1.0.0":"2017-05-04T12:49:48.477Z","1.1.0":"2017-09-11T15:32:15.426Z","2.0.0":"2020-05-07T19:11:09.728Z"},"author":{"name":"Jano González","email":"info@janogonzalez.com","url":"http://janogonzalez.com"},"repository":{"type":"git","url":"git://github.com/janogonzalez/ringbufferjs.git"},"homepage":"https://github.com/janogonzalez/ringbufferjs","keywords":["ring","buffer","circular","queue","ring buffer","circular buffer","data structure"],"bugs":{"url":"https://github.com/janogonzalez/ringbufferjs/issues"},"license":"MIT","readmeFilename":"README.md"}