{"bugs":{"url":"https://github.com/lleo/node-dequeue/issues","email":"lleoem@gmail.com"},"dist":{"shasum":"64ee18f20cf2dae739577faa99f9abaa451b0ed0","tarball":"https://registry.npmjs.org/dequeue/-/dequeue-1.0.4.tgz","integrity":"sha512-WOsU8AfqJm0wIQQpLLp6IkqW/XS4bvt1rGhYCK1hBaJWYqtJ2QFX0zV8VULc1scV8DP4+Od/slzVLT5CmgR6rg==","signatures":[{"sig":"MEUCIDCfitHBTfmjpAC5ERqbtuZUhcnFzx6ES/b0hsyEHQUeAiEAkkvegAfQF+O+MCPNCgYUTLDbMQs39/FAGc2VN5Y0MSI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/index.js","name":"dequeue","_from":".","author":{"url":"http://lleo-blog.blogspot.com/","name":"LLeo","email":"lleoem@gmail.com"},"readme":"A Simple Double Ended Queue Datastructure\n=========================================\n\nDequeue is implemented as a doubly linked circular list with a titular head\nnode. By \"titular head node\", I mean an empty node to designate the beginning\nand end of the circularly linked list. I first saw this construction in the\nlinux kernel source and it seem simple and elegant. I added the `.length`\nproperty to use it like I was using an Array.\n\nI was using a javascript Array as a FIFO. Somewhere between 100,000 and\n200,000 entries the program performance went to hell (dev host is a MBP\nw/8GB RAM). 15 minutes later, I implemented a simple dequeue and my FIFO\nscales up to millions of entries.\n\nIt is a drop-in replacement for javascript-arrays-as-fifo.\n\n## Example: Dequeue as a replacement for an Array as a FIFO\n\n    var Dequeue = require('dequeue')\n    \n    //var fifo = []\n    var fifo = new Dequeue()\n    \n    fifo.length === 0 //=> true\n    \n    fifo.push(d1)\n    fifo.length === 1 //=> true\n    \n    fifo.unshift(d2)\n    \n    fifo.pop() === d1 //=> true\n    \n    fifo.push(d3)\n    \n    fifo.shift() === d2 //=> true\n    \n    fifo.length === 1 //=> true; only d3 is in the dequeue\n    \n## API\n\n### `deque = new Dequeue()`\n\n### `deque.push(value)`\nPush a value on the end.\n\n### `value = deque.pop()`\nRemove a value off the end.\n\n### `deque.unshift(value)`\nPush a value on the beginning.\n\n### `value = deque.shift()`\nRemove a value off the beginning.\n\n### `deque.empty()`\nRemove all entries. This is NOT a test for an empty dequeue; use `deque.length`\nfor that.\n\n## Future Development\nSomething this simple does not really need a roadmap. However, I am thinking\nof adding APIs to facilitate walking the Linked List via an iterator. It will\nbe simple and fully backward compatible.\n\n## About the Code\n\nI was convinced by [a blog posting](http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding) [by Issac Z. Schlueter](http://blog.izs.me/) that I don't need\nsemicolons. So I don't use them.\n","engines":{"node":"*"},"_npmUser":{"name":"lleo","email":"lleoem@gmail.com"},"homepage":"https://github.com/lleo/node-dequeue","keywords":["datastructure","queue","double ended queue","fifo","FIFO","linked list"],"repository":{"url":"https://github.com/lleo/node-dequeue","type":"git"},"_npmVersion":"1.2.15","description":"A simple double ended queue datastructure","maintainers":[{"name":"lleo","email":"lleoem@gmail.com"}],"dependencies":{},"readmeFilename":"README.md","_id":"dequeue@1.0.4","version":"1.0.4"}