{"name":"grouped-queue","version":"1.0.0","description":"In memory queue system prioritizing tasks","main":"lib/queue.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git+https://github.com/SBoudrias/grouped-queue.git"},"keywords":["queue","async","task","flow","control"],"author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"license":"MIT","dependencies":{"lodash":"^4.17.15"},"devDependencies":{"mocha":"^7.0.0","sinon":"^8.0.4"},"gitHead":"b4769b6fe32819d4d20783c68b6e524b829301e1","bugs":{"url":"https://github.com/SBoudrias/grouped-queue/issues"},"homepage":"https://github.com/SBoudrias/grouped-queue#readme","_id":"grouped-queue@1.0.0","_nodeVersion":"13.3.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-XslfWrAGCYovQjveHODR0hllUrsn3UtvPFTkamHbgVHmkUA6eCIDmw3JDWVLJvuntTvYjwaPGamlyzK4/HAEOA==","shasum":"5bdb97934a9a17b19626ff3cc23c103f2622ef49","tarball":"http://registry-npm.ywwl.com/grouped-queue/download/grouped-queue-1.0.0.tgz","fileCount":4,"unpackedSize":7461,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeGBSfCRA9TVsSAnZWagAAyN0P/0eOTEHUeBeU9lyjmYQ0\nEZxOKQOZuIILJ6cVNdzfNPCzC2rRWFPVMQyfwZMWhKn8b3dJxGFRlXRgTCo0\n6L5owlS1NlQ49AJ+JMK1drTrxaHV1tnwksdSn1Hr2T+/3eGaFTa0DhqCh8D3\nDFoU3heRwAKFHAJQRzugbpnOXaDQxSPmuk2aaqgxhxw3VzLpx6/wEDkE3iT4\nxulnSl1AZm3OrkDLgttA3r5kay+0TNdvc0JqBqJm8ozkcJcLHseUx9JTCh+U\nM5VMOsjktIhpx5XWgSvwqi4EDQw41PzDGDknIAB/YarZRzASWP7z+bUWgkoG\nm4H7GryJLRYAN/gQBtiYuFd8wvUZuzKjtA9BUyk2D0GkrXXqGzbpOCmdQIfp\n2Tci007qCISrETddyoXAcUqXgRSvjGmIkkbbtUKdSEaDGbhlefp2cfbRlLey\n7lrmdQvKlf/yZlwW5aCBh3nN0djyAkm02sv05Sw0avu1jIQcVRAatvQ+JQL/\ns6rOICokb5RZ2H87ybKljvDx/p3ieB0Vpgj4timGq1su1BpicFvh31VpfYNf\ng+dxnBAApWCSKpiCBM+HRZFQaGXRMpISHwHAg2rLOV9sqqmzZV8Ff24j1h89\nn+z3vdcUW45Amktj8be4vCIaPwWwkiyLJjezw7wbrf+nMXaa5TgwuUOdYPXK\nnOdS\r\n=zTee\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/YYKfJBQQvT8ZqT80QcmfiBckEKIvczYVYlW0JZ5ABQIgGbX6TtveOlrzuMISI4s8ilY16dhdGCSF1runlpouvKM="}],"size":3038,"noattachment":false,"key":"/grouped-queue/-/grouped-queue-1.0.0.tgz"},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grouped-queue_1.0.0_1578636447194_0.09222274366733685"},"_hasShrinkwrap":false,"readme":"Grouped Queue [![Build Status](https://travis-ci.org/SBoudrias/grouped-queue.svg?branch=master)](https://travis-ci.org/SBoudrias/grouped-queue)\n==============\n\nIn memory queue system prioritizing tasks.\n\n\nDocumentation\n=============\n\nInstallation\n-------------\n\n``` bash\n$ npm install --save grouped-queue\n```\n\nMethods\n------------\n\n### Constructor\n\nThe constructor takes an optional array of task groups. The first `String` name will be the first queue to be emptied, the second string will be the second group emptied, etc.\n\nBy default, the constructor will always add a `default` queue in the last position. You can overwrite the position of the `default` group if you specify it explicitly.\n\n``` javascript\nvar Queue = require('grouped-queue');\n\nvar queue = new Queue([ 'first', 'second', 'third' ]);\n```\n\n### Queue#add `add( [group], task, [options] )`\n\nAdd a task into a group queue. If no group name is specified, `default` will be used.\n\nImplicitly, each time you add a task, the queue will start emptying (if not already running).\n\nEach task function is passed a callback function. This callback must be called when the task is complete.\n\n``` javascript\nqueue.add(function( cb ) {\n  DB.fetch().then( cb );\n});\n```\n\n#### Option: `once`\n\nYou can register tasks in queues that will be dropped if they're already planned. This is done with the `once` option. You pass a String (basically a name) to the `once` option.\n\n``` javascript\n// This one will eventually run\nqueue.add( method, { once: \"readDB\" });\n\n// This one will be dropped as `method` is currently in the queue\nqueue.add( method3, { once: \"readDB\" });\n```\n\n#### Option: `run`\n\nYou can register a task without launching the run loop by passing the argument `run: false`.\n\n```javascript\nqueue.add( method, { run: false });\n```\n\n### Pro tip\n\nBind your tasks with context and arguments!\n\n``` javascript\nvar task = function( models, cb ) {\n  /* you get `models` data here! */\n};\nqueue.add( task.bind(null, models) );\n```\n\n### That's all?\n\nYes!\n\nEvents\n-------------\n\n### `end`\n\nThis event is called **each time** the queue emptied itself.\n\n\nContributing\n=====================\n\n**Style Guide**: Please base yourself on [Idiomatic.js](https://github.com/rwldrn/idiomatic.js) style guide with two space indent  \n**Unit test**: Unit tests are written in Mocha. Please add a unit test for every new feature\nor bug fix. `npm test` to run the test suite.  \n**Documentation**: Add documentation for every API change. Feel free to send corrections\nor better docs!  \n**Pull Requests**: Send _fixes_ PR on the `master` branch.\n\n\nLicense\n=====================\n\nCopyright (c) 2013 Simon Boudrias (twitter: @vaxilart)  \nLicensed under the MIT license.\n","publish_time":1578636447341,"_cnpm_publish_time":1578636447341,"dist-tags":{"latest":"2.1.0","next-2":"2.0.0-beta.2"}}