115 lines
5.1 KiB
JSON
115 lines
5.1 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "throat@^4.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "throat",
|
||
|
"name": "throat",
|
||
|
"rawSpec": "^4.1.0",
|
||
|
"spec": ">=4.1.0 <5.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/metro"
|
||
|
]
|
||
|
],
|
||
|
"_from": "throat@>=4.1.0 <5.0.0",
|
||
|
"_id": "throat@4.1.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/throat",
|
||
|
"_nodeVersion": "8.0.0",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "s3://npm-registry-packages",
|
||
|
"tmp": "tmp/throat-4.1.0.tgz_1499385711702_0.8979995066765696"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "forbeslindesay",
|
||
|
"email": "forbes@lindesay.co.uk"
|
||
|
},
|
||
|
"_npmVersion": "4.6.1",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "throat@^4.1.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "throat",
|
||
|
"name": "throat",
|
||
|
"rawSpec": "^4.1.0",
|
||
|
"spec": ">=4.1.0 <5.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/jest-changed-files",
|
||
|
"/jest-runner",
|
||
|
"/metro"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz",
|
||
|
"_shasum": "89037cbc92c56ab18926e6ba4cbb200e15672a6a",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "throat@^4.1.0",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/metro",
|
||
|
"author": {
|
||
|
"name": "ForbesLindesay"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/ForbesLindesay/throat/issues"
|
||
|
},
|
||
|
"dependencies": {},
|
||
|
"description": "Throttle the parallelism of an asynchronous (promise returning) function / functions",
|
||
|
"devDependencies": {
|
||
|
"coveralls": "^2.11.2",
|
||
|
"flow-bin": "^0.49.1",
|
||
|
"istanbul": "^0.4.5",
|
||
|
"jest": "^20.0.4",
|
||
|
"promise": "^8.0.0",
|
||
|
"sauce-test": "^1.0.0",
|
||
|
"test-result": "^2.0.0",
|
||
|
"testit": "^2.1.3",
|
||
|
"typescript": "^2.3.4"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "89037cbc92c56ab18926e6ba4cbb200e15672a6a",
|
||
|
"tarball": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz"
|
||
|
},
|
||
|
"files": [
|
||
|
"index.d.ts",
|
||
|
"index.js",
|
||
|
"index.js.flow"
|
||
|
],
|
||
|
"gitHead": "185faa1a7cf19b2dde8d1f5acaa1fed23b576107",
|
||
|
"homepage": "https://github.com/ForbesLindesay/throat#readme",
|
||
|
"keywords": [
|
||
|
"promise",
|
||
|
"aplus",
|
||
|
"then",
|
||
|
"throttle",
|
||
|
"concurrency",
|
||
|
"parallelism",
|
||
|
"limit"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "forbeslindesay",
|
||
|
"email": "forbes@lindesay.co.uk"
|
||
|
}
|
||
|
],
|
||
|
"name": "throat",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# throat\n\nThrottle the parallelism of an asynchronous, promise returning, function / functions. This has special utility when you set the concurrency to `1`. That way you get a mutually exclusive lock.\n\n[![Build Status](https://img.shields.io/travis/ForbesLindesay/throat/master.svg)](https://travis-ci.org/ForbesLindesay/throat)\n[![Coverage Status](https://img.shields.io/coveralls/ForbesLindesay/throat/master.svg?style=flat)](https://coveralls.io/r/ForbesLindesay/throat?branch=master)\n[![Dependency Status](https://img.shields.io/david/ForbesLindesay/throat.svg)](https://david-dm.org/ForbesLindesay/throat)\n[![NPM version](https://img.shields.io/npm/v/throat.svg)](https://www.npmjs.com/package/throat)\n[![Greenkeeper badge](https://badges.greenkeeper.io/ForbesLindesay/throat.svg)](https://greenkeeper.io/)\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/throat.svg)](https://saucelabs.com/u/throat)\n\n## Installation\n\n npm install throat\n\n## API\n\n### throat(concurrency)\n\nThis returns a function that acts a bit like a lock (exactly as a lock if concurrency is 1).\n\nExample, only 2 of the following functions will execute at any one time:\n\n```js\nconst throat = require('throat')(2);\n// alternatively provide your own promise implementation\nconst throat = require('throat')(require('promise'))(2);\nconst promise = Promise.resolve();\n\nconst resA = throat(() => /* async stuff... */ promise);\nconst resB = throat(() => /* async stuff... */ promise);\nconst resC = throat(() => /* async stuff... */ promise);\nconst resD = throat(() => /* async stuff... */ promise);\nconst resE = throat(() => /* async stuff... */ promise);\n```\n\n### throat(concurrency, worker)\n\nThis returns a function that is an exact copy of `worker` except that it will only execute up to `concurrency` times in parallel before further requests are queued:\n\n```js\nconst throat = require('throat');\n// alternatively provide your own promise implementation\nconst throat = require('throat')(require('promise'));\n\nconst input = ['fileA.txt', 'fileB.txt', 'fileC.txt', 'fileD.txt'];\nconst data = Promise.all(input.map(throat(2, fileName => readFile(fileName))));\n```\n\nOnly 2 files will be read at a time, sometimes limiting parallelism in this way can improve scalability.\n\n## License\n\n MIT\n",
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/ForbesLindesay/throat.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"coverage": "istanbul cover test/index.js",
|
||
|
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
|
||
|
"flow": "flow",
|
||
|
"test": "node test/index.js && npm run test:types && node test/browser.js",
|
||
|
"test:types": "jest",
|
||
|
"tsc": "tsc --noEmit"
|
||
|
},
|
||
|
"version": "4.1.0"
|
||
|
}
|