{"name":"grouped-queue","version":"1.1.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":"9fde5b62d5cc7a29bafec43f496f799150a1fffd","bugs":{"url":"https://github.com/SBoudrias/grouped-queue/issues"},"homepage":"https://github.com/SBoudrias/grouped-queue#readme","_id":"grouped-queue@1.1.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-rZOFKfCqLhsu5VqjBjEWiwrYqJR07KxIkH4mLZlNlGDfntbb4FbMyGFP14TlvRPrU9S3Hnn/sgxbC5ZeN0no3Q==","shasum":"63e3f9ca90af952269d1d40879e41221eacc74cb","tarball":"http://registry-npm.ywwl.com/grouped-queue/download/grouped-queue-1.1.0.tgz","fileCount":4,"unpackedSize":7578,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemBHQCRA9TVsSAnZWagAAKhsQAI9remUsNeK++3uqyoUV\nDXSyK863c2aSB+wwU3Ly+NuQZafibrbUilZ5X6dC5lup7EQS7ZpptFuSGqPT\nXNrQagj835I49NMQtYMTwyFPDoboxunwJVSNxTpsTZiEnO2kpGFdwsA4hBEl\nV9v6JUgJUGvWYKXbHb8wdffL5hwlRIUMg0zrEgHV73V/TUUFhySI43s5vq+i\nA0uLFf4cieac7ATdIqOiZstnxYCgfMflshyHoYw2kL08hDPVWYTbx9oCEVVj\nhWXRwlimffFTxGXitlKe6o7hM4IJCZNzaKMkONuAyjuUnno9ELK5imWNhuO4\nifpGiPm2+IN54konryiNjakLvaJciSr0BmZOCfLHPIG3+EopXoDrzjFk28pO\n7X7J2n+WsuEslaKkgRIwF2swaoaAjToafdvpimI547tZO+cRutaXndvJ0/x3\n69fwD4TBeBQy8huv4q6app95qSJAnWLStVMNmZsy4nVw219x/KegIkjP0l0H\nSKTgYhUnpJ08UMHzUeX9I3/aLI+qU0IPIYkSUzBC2ok7ejmkkbahNu4ImnJT\nnO2SkEqXf1GWsoTTpYQ+XHeaSUTEMbE/Or0hA0PW6AUSticSU8VB8CBUDmNL\nJjzDvaN0xzVd9q0SQyiIt4nRSDnZ5gyac2Y94hf1W/yCV0mBgXTkZAco/iC2\n8a6H\r\n=Maap\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDg/rfHntU7oJU1JIKsJAgUigtPYsjz1kpSWDSvwvsuQIhAO1m6dCcVtwoks+dgVTJMzzno4TVLeLpTojgivjLbtmq"}],"size":3057,"noattachment":false,"key":"/grouped-queue/-/grouped-queue-1.1.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.1.0_1587024336426_0.7855349307621111"},"_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":1587024336573,"_cnpm_publish_time":1587024336573,"dist-tags":{"latest":"2.1.0","next-2":"2.0.0-beta.2"}}