{"_id":"queue-typescript","_rev":"2-872832f27d43647e903c167ce1613fd7","name":"queue-typescript","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"queue-typescript","version":"1.0.0","description":"Simple Typescript Queue with generics type support","main":"lib/src/index.js","typings":"lib/src/index","files":["lib/src/"],"repository":{"type":"git","url":"git+https://github.com/sfkiwi/queue-typescript.git"},"author":{"name":"Mike Sutherland","email":"mjfsutherland@gmail.com"},"license":"MIT","private":false,"keywords":["typescript","javascript","linked-list","linkedlist","queue"],"bugs":{"url":"https://github.com/sfkiwi/queue-typescript/issues"},"homepage":"https://github.com/sfkiwi/queue-typescript#readme","scripts":{"pretest":"yarn run build","build":"tsc","test":"nyc ./node_modules/.bin/mocha","coverage":"yarn run build && nyc ./node_modules/.bin/mocha","coverage:lcov":"nyc report --reporter=text-lcov | coveralls","coverage:report":"nyc report --reporter text-summary --reporter html && open coverage/index.html","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage","clean":"rm -fr lib coverage .nyc_output"},"devDependencies":{"@types/chai":"^4.1.2","@types/mocha":"^5.2.0","chai":"^4.1.2","coveralls":"^3.0.1","eslint":"^4.18.1","eslint-plugin-react":"^7.7.0","expect.js":"^0.3.1","mocha":"^4.0.1","nyc":"^11.6.0","source-map-support":"^0.5.4","ts-node":"^5.0.1","typescript":"^2.8.1"},"dependencies":{"linked-list-typescript":"^1.0.11"},"gitHead":"19493a00850a28b38b568d812821318f61ea3a62","_id":"queue-typescript@1.0.0","_npmVersion":"6.0.1","_nodeVersion":"9.11.0","_npmUser":{"name":"sfkiwi","email":"mjfsutherland@gmail.com"},"dist":{"integrity":"sha512-sQi23mHYQqMdFw6oxD3DhtsabbQsOpTQSjKDmGrGETMBtFeW3YyytVBcGWCsUHWLfJJtee/bkYRPf0Huxy3/cw==","shasum":"ec1d564390e21548725c17d4f18527bda0e95ffd","tarball":"https://registry.npmjs.org/queue-typescript/-/queue-typescript-1.0.0.tgz","fileCount":6,"unpackedSize":9328,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBS1PCRA9TVsSAnZWagAAiF4QAIfO+nVpFi4I8knQX2Mn\nFOqh+Jcw+PQ9wNR4p4hf/3ZI5pNF2N1goT0w+o4PWhQwAVZNT/ai4uesTsmN\nVtLdb9pUWGJ/WgC3KgDketl4AMGFJexem2bN6P2NRU3R9pYhr56i3jlIqLF/\ngdoxYPbRlSh0ceDQ6cqr2z12bDPBP8DCoJ3C0InHZ4K/7IaDBdGcllBkmJWi\nf5oooxpe60NPkbeDT8ngmOF6yJkcq4egXjVR1XK1K8ZM/LuvvRO2/Ge9v+8W\nj6SHuFl3F+KqtHYJZah8om3Wgcvn9UO3qXSB5RSxrsiySzSi6gdAcvs1AQda\nn74vnUUMPPFhvoqurix2V1u/ytf7/zYcvEax8PYPi+NuTV3wNjpchXIwaEBp\n5KPKpPAU8okQxH/xtSIDkgGdXhZuPaXq/MWdBPXY09LyuXwe2DgyIyTjyk77\ngYRtOh5P9AQkMUBJjZIMsWmZ7gzHTIn1fddJyl0y4Fe0U3XA64J37zCBV3Pt\n8poFJtpBacZMyYmJyjr9k8S7+y9XpU6XXO5NkdTMXzepWnX3atBTV0S65nR9\nYg5JFOwPfw7CW3rYgnD7CH8Pg0OBRccdr9xJ/u+Az3b7E1ClmMWwlovK7nZN\n2jEJCF+9vLpMQZOn5hEbQMCpVgTbfbxCpedwQ6ajxOUKQ4sWMhM1CxzvlhZH\nGdPl\r\n=VtGl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHeeJqo8D/RwYWDbsP/9uvIurHMrsMeKI1cZ1KOcLZq2AiBZJRUbSrvRaqHNOK2sT2rIPOAl3iwsRwK0i4wL5/MaFw=="}]},"maintainers":[{"name":"sfkiwi","email":"mjfsutherland@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/queue-typescript_1.0.0_1527065934503_0.8946282304925326"},"_hasShrinkwrap":false},"1.0.1":{"name":"queue-typescript","version":"1.0.1","description":"Simple Typescript Queue with generics type support","main":"lib/src/index.js","typings":"lib/src/index","files":["lib/src/"],"repository":{"type":"git","url":"git+https://github.com/sfkiwi/queue-typescript.git"},"author":{"name":"Mike Sutherland","email":"mjfsutherland@gmail.com"},"license":"MIT","private":false,"keywords":["typescript","javascript","linked-list","linkedlist","queue"],"bugs":{"url":"https://github.com/sfkiwi/queue-typescript/issues"},"homepage":"https://github.com/sfkiwi/queue-typescript#readme","scripts":{"pretest":"yarn run build","build":"tsc","test":"nyc ./node_modules/.bin/mocha","coverage":"yarn run build && nyc ./node_modules/.bin/mocha","coverage:lcov":"nyc report --reporter=text-lcov | coveralls","coverage:report":"nyc report --reporter text-summary --reporter html && open coverage/index.html","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage","clean":"rm -fr lib coverage .nyc_output"},"devDependencies":{"@types/chai":"^4.1.2","@types/mocha":"^5.2.0","chai":"^4.1.2","coveralls":"^3.0.1","eslint":"^4.18.1","eslint-plugin-react":"^7.7.0","expect.js":"^0.3.1","mocha":"^4.0.1","nyc":"^11.6.0","source-map-support":"^0.5.4","ts-node":"^5.0.1","typescript":"^2.8.1"},"dependencies":{"linked-list-typescript":"^1.0.11"},"gitHead":"d84244cd76385c3ba7bb864caa84fd7900c91a20","_id":"queue-typescript@1.0.1","_npmVersion":"6.0.1","_nodeVersion":"9.11.0","_npmUser":{"name":"sfkiwi","email":"mjfsutherland@gmail.com"},"dist":{"integrity":"sha512-tkK08uPfmpPl0cX1WRSU3EoNb/T5zSoZPGkkpfGX4E8QayWvEmLS2cI3pFngNPkNTCU5pCDQ1IwlzN0L5gdFPg==","shasum":"2d7842fc3b3e0e3f33d077887a8f2a5bb0baf460","tarball":"https://registry.npmjs.org/queue-typescript/-/queue-typescript-1.0.1.tgz","fileCount":6,"unpackedSize":9614,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBUEbCRA9TVsSAnZWagAAGWAQAIYgZot8caNRfuT5upRO\nYVoJ09T2Em/YiJiWsW304g7L3eigezKtcGEmTxEOxE5nCNtz1mxRfrAP+3Jt\nRTJbbsU56RP1mnjNh9bk8K3PSPD9+sy1UeB6kte3NU5MB0sjIpGoWEjg+GhS\ns9RXxG3b8D5dFhTQD4fx0iRMIQZw2XRnIskhuw1ujUsu6q6zw1B6e+4qfvmX\nr9BnIKKyYioIfRB4Kq63ciih3dXRmSYabiuEJwW8Rzb50r0DqMuhmivIOETh\nYQ0s9FcIuG7UM+7YNvMLlXEu+ZoACFQDP2RzQ+ZXE2IRDyzh0PKucBiu1ygM\nYqUhqZlWBjSLF9zDc+K7cRBB8A4IFy7AaZd0I6kk1QXuuC+MTOK+ZRapXIdA\nOG/SW45QuNQz42Rk5cNkHS136mzt7GrtAo5U1WGSMF1u+tEoJ5e5grlkWCSW\nBlB5ipnbLDLR91ytLMBfst3pR97f6a2izqjCD6693EGQZ3rAgnnbzjYM3yuA\n3N6aFtP3N4DyPe5o75cs+CQuyzh1X76LbzuGz/sVlYFLPOT9aAe5xzZ1sRdE\nT1payzthyCuEnGpV/rblkOwvdtU041INlV399sCyhNl8qSEu3Eo0MV35Xq4t\na49HS6wNh0VrzBevcCYKnAiwYGr8jN6gTYmnE9HfNpQxEx0ZlvqeZgqFPEVa\nTYPb\r\n=y5L3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDeglfLmZeNwVyUuL1VlbhOxGsjhHfoaXubRFl2x1pqYAIgLaN+3bIHb1RCXKLWzREWsBd5jiJFNhAbXF3QQ3iKhXk="}]},"maintainers":[{"name":"sfkiwi","email":"mjfsutherland@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/queue-typescript_1.0.1_1527071003279_0.7861694579091805"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-23T08:58:54.502Z","1.0.0":"2018-05-23T08:58:54.570Z","modified":"2022-05-13T22:38:43.159Z","1.0.1":"2018-05-23T10:23:23.380Z"},"maintainers":[{"name":"sfkiwi","email":"mjfsutherland@gmail.com"}],"description":"Simple Typescript Queue with generics type support","homepage":"https://github.com/sfkiwi/queue-typescript#readme","keywords":["typescript","javascript","linked-list","linkedlist","queue"],"repository":{"type":"git","url":"git+https://github.com/sfkiwi/queue-typescript.git"},"author":{"name":"Mike Sutherland","email":"mjfsutherland@gmail.com"},"bugs":{"url":"https://github.com/sfkiwi/queue-typescript/issues"},"license":"MIT","readme":"# queue-typescript \n[![Build Status][travis-badge]][travis] [![Coverage Status][coveralls-badge]][coveralls]\n\nSimple Typescript [Queue][wiki] with generics type templating and support for iterator \nand iterable protocols.\n\nThis queue uses the [linked-list-typescript][list] as the underlying datastructure.\n\nSee Also:\n - [linked-list-typescript][list]\n - [stack-typescript][stack]\n - [hashlist-typescript][hashlist]\n\n## Installation\n\n[npm][]:\n\n```bash\nnpm install --save queue-typescript\n```\n\n[yarn][]:\n\n```bash\nyarn add queue-typescript\n```\n\n## Building from source\n\ninstall dev dependencies. There are no production dependencies.\n\n```bash\nyarn\nnpm install\n```\n\nbuild using the options in `tsconfig.json`\n\n```bash\nyarn|npm run build\n```\n\nrun all package tests\n\n```bash\nyarn|npm run test\n```\n\nsee the test coverage report\n\n```bash\nyarn|npm run coverage\nyarn|npm run coverage:report\n```\n\n## Usage\n\nImporting:\n\n```typescript\nimport { Queue } from 'queue-typescript';\nconst { Queue } = require('queue-typescript')\n```\n\n## API\n\n### Queue<T>(...values: T[])\n\n#### Queue<T>()\n\nCreate an empty queue by omitting any arguments during instantiation.\n\n```typescript\nlet queue = new Queue<number>()\n```\n\n#### Queue<T>(...values: T[])\n\nCreate a new queue and initialize it with values. Values will be added from front\nto back. i.e. the first argument will be at the front of the queue and the last \nargument will be at the back of the queue.\n\nSpecify the type using the typescript templating to enable type-checking of all\nvalues going into and out of the queue.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\n```\n\n```typescript\nlet items: string[] = ['one', 'two', 'three', 'four'];\nlet queue = new Queue<string>(...items);\n```\n\nTypescript will check if the values match the type given to the template\nwhen initializing the new queue.\n\n```typescript\nlet items: = ['one', 'two', 'three', 4];\nlet queue = new Queue<string>(...items); // arguments are not all strings\n```\n\n#### Queue<Foo>(...values: Foo[])\n\nCreate a new queue using custom types or classes. All values are retained as references\nand not copies so removed values can be compared using strict comparison.\n\n```typescript\nclass Foo {\n  private val:number;\n  constructor(val: number) {\n    this.val = val;\n  }\n  get bar(): number { return this.val }\n}\n\nlet foo1 = new Foo(1);\nlet foo2 = new Foo(2);\nlet foo3 = new Foo(3);\n\nlet fooQueue = new Queue<Foo>(foo1, foo2, foo3)\n\nfooQueue.front.bar // => 1\nlet val = queue.dequeue()\nval // => foo1\n```\n\n\n\n#### Queue<any>(...values: any[])\n\nSpecify `any` to allow the queue to take values of any type.\n\n```typescript\nlet queue = new Queue<any>(4, 'hello' { hello: 'world' })\nqueue.length // => 3\nqueue.front // => 4\n```\n\n#### Queue#[Symbol.iterator]\n\nThe queue supports both iterator and iterable protocols allowing it to be used\nwith the `for...of` and `...spread` operators and with deconstruction.\n\n`for...of`:\n\n```typescript\nlet items: number[] = [4, 5, 6];\nlet queue = new Queue<number>(...items);\n\nfor (let item of queue) {\n  console.log(item)\n}\n//4\n//5\n//6\n```\n\n`...spread`:\n\n```typescript\nlet items: number[] = [4, 5, 6];\nlet queue = new Queue<number>(...items);\n\nfunction manyArgs(...args) {\n  for (let i in args) {\n    console.log(args[i])\n  }\n}\nmanyArgs(...queue);\n//4\n//5\n//6\n```\n\n`deconstruction`:\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\n\nlet [a, b, c] = queue;\n//a => 4\n//b => 5\n//c => 6\n```\n\n#### Queue<T>#front :T\n\nPeek at the front of the queue. This will not remove the value\nfrom the queue.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\nqueue.front // => 4\n```\n\n#### Queue<T>#length :number\n\nQuery the length of the queue. An empty queue will return 0.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\nqueue.length // => 4\n```\n\n#### Queue<T>#enqueue(val: T): boolean\n\nEnqueue an item at the back of the queue. The new item will replace the previous last item.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\nqueue.length // => 4\nqueue.enqueue(8)\nqueue.length // => 5\n```\n\n#### Queue<T>#dequeue(): T\n\nRemoves the item from the front of the queue and returns the item.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\nqueue.length // => 4\nlet val = queue.dequeue()\nqueue.length // => 3\nqueue.front // => 5\nval // => 4\n```\n\n#### Queue<T>#toArray(): T[]\n\nThis method simply returns `[...this]`.\n\nConverts the queue into an array and returns the array representation. This method does\nnot mutate the queue in any way.\n\nObjects are not copied, so all non-primitive items in the array are still referencing\nthe queue items.\n\n```typescript\nlet items: number[] = [4, 5, 6, 7];\nlet queue = new Queue<number>(...items);\nlet result = queue.toArray()\nresult // => [4, 5, 6, 7]\n```\n\n## License\n\n[MIT][license] © [Michael Sutherland][author]\n\n<!-- Definitions -->\n\n[travis-badge]: https://img.shields.io/travis/sfkiwi/queue-typescript.svg\n\n[travis]: https://travis-ci.org/sfkiwi/queue-typescript\n\n[coveralls-badge]: https://img.shields.io/coveralls/github/sfkiwi/queue-typescript.svg\n\n[coveralls]: https://coveralls.io/github/sfkiwi/queue-typescript\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[yarn]: https://yarnpkg.com/lang/en/docs/install/\n\n[license]: LICENSE.md\n\n[author]: http://github.com/sfkiwi\n\n[wiki]: https://en.wikipedia.org/wiki/Queue_(abstract_data_type)\n\n[list]: https://www.npmjs.com/package/linked-list-typescript\n\n[stack]: https://www.npmjs.com/package/stack-typescript\n\n[queue]: https://www.npmjs.com/package/queue-typescript\n\n[hashlist]: https://www.npmjs.com/package/hashlist-typescript\n","readmeFilename":"README.md"}