{"_id":"@blakeembrey/deque","_rev":"2999269","name":"@blakeembrey/deque","description":"Deques are a generalization of stacks and queues","dist-tags":{"latest":"1.0.5"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"time":{"modified":"2023-08-29T08:47:32.000Z","created":"2018-09-10T01:31:44.916Z","1.0.5":"2019-02-19T02:09:11.823Z","1.0.4":"2018-11-28T01:49:27.325Z","1.0.3":"2018-09-11T16:03:47.343Z","1.0.2":"2018-09-11T06:12:41.429Z","1.0.1":"2018-09-10T16:51:16.196Z","1.0.0":"2018-09-10T01:31:44.916Z"},"users":{},"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"versions":{"1.0.5":{"name":"@blakeembrey/deque","version":"1.0.5","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepare":"npm run build","benchmark":"ts-node benchmark/construct.ts && ts-node benchmark/rotate.ts"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","fifo","lifo","queue","stack","double","linked","list","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^24.0.6","@types/node":"^11.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^1.2.0","jest":"^24.1.0","lint-staged":"^8.1.0","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^8.0.2","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"ef0fe9431013cd457b1c3263da685889005dc8c6","_id":"@blakeembrey/deque@1.0.5","_nodeVersion":"11.10.0","_npmVersion":"6.7.0","dist":{"shasum":"f4fa17fc5ee18317ec01a763d355782c7b395eaf","size":9016,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.5.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.5_1550542151691_0.6177026874734015"},"_hasShrinkwrap":false,"publish_time":1550542151823,"_cnpm_publish_time":1550542151823,"_cnpmcore_publish_time":"2021-12-16T16:39:16.968Z"},"1.0.4":{"name":"@blakeembrey/deque","version":"1.0.4","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","fifo","lifo","queue","stack","double","linked","list","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^23.3.1","@types/node":"^10.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^1.2.0","jest":"^23.5.0","lint-staged":"^8.1.0","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^7.0.1","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"b692c13e1a89faf7c5d5a8a3b6bd8d768cdc900a","_id":"@blakeembrey/deque@1.0.4","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"4fc65476814e6b807140f258852055e5f69e5ccb","size":8962,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.4.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.4_1543369767217_0.1036920221588018"},"_hasShrinkwrap":false,"publish_time":1543369767325,"_cnpm_publish_time":1543369767325,"_cnpmcore_publish_time":"2021-12-16T16:39:17.295Z"},"1.0.3":{"name":"@blakeembrey/deque","version":"1.0.3","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","linked","list","double","endpoint","queue","stack","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^23.3.1","@types/node":"^10.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^0.14.3","jest":"^23.5.0","lint-staged":"^7.2.2","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^7.0.1","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"a96da5c75630035f6e7c736ebc775eafd4a00e19","_id":"@blakeembrey/deque@1.0.3","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"f83871859441ba4ad9997fca5a3050dcfd9e2363","size":8954,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.3.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.3_1536681827230_0.17093648657849858"},"_hasShrinkwrap":false,"publish_time":1536681827343,"_cnpm_publish_time":1536681827343,"_cnpmcore_publish_time":"2021-12-16T16:39:17.537Z"},"1.0.2":{"name":"@blakeembrey/deque","version":"1.0.2","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","linked","list","double","endpoint","queue","stack","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^23.3.1","@types/node":"^10.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^0.14.3","jest":"^23.5.0","lint-staged":"^7.2.2","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^7.0.1","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"2504e0250a4805835f7dcfc5b118d46bc8839726","_id":"@blakeembrey/deque@1.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"ac6253092ddfcf638e86de0d1b4ed50e77a037a3","size":8733,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.2.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.2_1536646361252_0.4683237909027982"},"_hasShrinkwrap":false,"publish_time":1536646361429,"_cnpm_publish_time":1536646361429,"_cnpmcore_publish_time":"2021-12-16T16:39:17.743Z"},"1.0.1":{"name":"@blakeembrey/deque","version":"1.0.1","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","linked","list","double","endpoint","queue","stack","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^23.3.1","@types/node":"^10.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^0.14.3","jest":"^23.5.0","lint-staged":"^7.2.2","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^7.0.1","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"0b72bd23a640796501bb176d1dca76e51384a74d","_id":"@blakeembrey/deque@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"c429239c84c31d219dea28f4763c2491469aa2bf","size":8469,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.1.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.1_1536598276031_0.3369300954697938"},"_hasShrinkwrap":false,"publish_time":1536598276196,"_cnpm_publish_time":1536598276196,"_cnpmcore_publish_time":"2021-12-16T16:39:17.971Z"},"1.0.0":{"name":"@blakeembrey/deque","version":"1.0.0","description":"Deques are a generalization of stacks and queues","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prettier":"prettier --single-quote --no-semi --write","lint":"tslint \"src/**/*.ts\" --project tsconfig.json","format":"npm run prettier -- \"src/**/*.ts\"","build":"rimraf dist && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/deque.git"},"keywords":["deque","linked","list","double","endpoint","queue","stack","iterator","iteration"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"homepage":"https://github.com/blakeembrey/deque","jest":{"roots":["<rootDir>/src/"],"transform":{"\\.tsx?$":"ts-jest"},"testRegex":"(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","jsx","json","node"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,json,css,md}":["npm run prettier","git add"]},"publishConfig":{"access":"public"},"devDependencies":{"@types/benchmark":"^1.0.31","@types/jest":"^23.3.1","@types/node":"^10.9.4","benchmark":"^2.1.4","denque":"^1.3.0","double-ended-queue":"^2.1.0-0","husky":"^0.14.3","jest":"^23.5.0","lint-staged":"^7.2.2","prettier":"^1.14.2","rimraf":"^2.5.4","ts-jest":"^23.1.4","ts-node":"^7.0.1","tslint":"^5.0.0","tslint-config-prettier":"^1.15.0","tslint-config-standard":"^8.0.0","typescript":"^3.0.3"},"dependencies":{},"gitHead":"ea99ad83aa591f418e3a3e0d5e4ec8bb0baf37fa","_id":"@blakeembrey/deque@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"9cf31241e242aea12692b06c378ddda72eda53c7","size":8153,"noattachment":false,"key":"/@blakeembrey/deque/-/@blakeembrey/deque-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@blakeembrey/deque/download/@blakeembrey/deque-1.0.0.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deque_1.0.0_1536543104673_0.7006297400677153"},"_hasShrinkwrap":false,"publish_time":1536543104916,"_cnpm_publish_time":1536543104916,"_cnpmcore_publish_time":"2021-12-16T16:39:18.215Z"}},"readme":"# Deque\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][downloads-image]][downloads-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n\n> Deques are a generalization of stacks and queues (the name is pronounced \"deck\" and is short for \"double-ended queue\").\n> -- [Python `collections`](https://docs.python.org/3/library/collections.html#collections.deque).\n\n## Installation\n\n```\nnpm install @blakeembrey/deque --save\n```\n\n## Usage\n\n- `size` Returns the number of elements in the deque.\n- `push(x)` Add `x` to right side of the deque.\n- `pushLeft(x)` Add `x` to the left side of the deque.\n- `clear()` Remove all elements from the deque leaving it with length 0.\n- `extend(iterable)` Extend the right side of the deque by appending elements from iterable.\n- `extendLeft(iterable)` Extend the left side of the deque by appending elements from iterable.\n- `peek(i)` Return the element at index `i` in the deque.\n- `indexOf(x, start?)` Return the position of `x` in the deque.\n- `has(x)` Return a boolean indicating whether `x` is in the deque.\n- `insert(i, x)` Insert `x` into the deque at position `i`.\n- `pop()` Remove and return an element from the right side of the deque. If no elements are present, throws `RangeError`.\n- `popLeft()` Return and return an element from the left side of the deque. If no elements are present, throws `RangeError`.\n- `delete(i)` Delete the value at position `i`.\n- `reverse()` Reverse the elements of the deque in-place.\n- `rotate(n=1)` Rotate the deque `n` steps to the right.\n- `entries()` Return an iterable of deque.\n- `@@iterator()` Return an iterable of deque.\n\n```js\nimport { Deque } from '@blakeembrey/deque'\n\nconst d = new Deque('ghi')\n\nfor (const value of d) {\n  console.log(value.toUpperCase()) //=> G H I\n}\n\nd.push('j')\nd.pushLeft('f')\nd //=> Deque(['f', 'g', 'h', 'i', 'j'])\n\nd.pop() //=> 'j'\nd.popLeft() //=> 'f'\n\nArray.from(d) //=> ['g', 'h', 'i']\n\nd.peek(0) //=> 'g'\nd.peek(-1) //=> 'i'\n\nd.extend('jkl')\nd //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])\n\nd.rotate(1)\nd //=> Deque(['l', 'g', 'h', 'i', 'j', 'k'])\n\nd.rotate(-1)\nd //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])\n\nconst d2 = new Deque(d)\n\nd2 //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])\n```\n\n## TypeScript\n\nThis project uses [TypeScript](https://github.com/Microsoft/TypeScript) and publishes definitions on NPM.\n\n## Reference\n\nCircular array implementation originally based on [`denque`](https://github.com/Salakar/denque) with additional optimizations.\n\n## License\n\nApache 2.0\n\n[npm-image]: https://img.shields.io/npm/v/@blakeembrey/deque.svg?style=flat\n[npm-url]: https://npmjs.org/package/@blakeembrey/deque\n[downloads-image]: https://img.shields.io/npm/dm/@blakeembrey/deque.svg?style=flat\n[downloads-url]: https://npmjs.org/package/@blakeembrey/deque\n[travis-image]: https://img.shields.io/travis/blakeembrey/deque.svg?style=flat\n[travis-url]: https://travis-ci.org/blakeembrey/deque\n[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/deque.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/blakeembrey/deque?branch=master\n","_attachments":{},"homepage":"https://github.com/blakeembrey/deque","bugs":{"url":"https://github.com/blakeembrey/deque/issues"},"license":"Apache-2.0"}