{
	"name": "await-semaphore",
	"versions": {
		"0.1.0": {
			"name": "await-semaphore",
			"version": "0.1.0",
			"description": "Awaitable semaphore/mutex",
			"main": "index.js",
			"scripts": {
				"prebuild": "typings install",
				"build": "tsc",
				"test": "mocha test.js"
			},
			"repository": {
				"type": "git",
				"url": "git+https://github.com/notenoughneon/await-semaphore.git"
			},
			"keywords": [
				"promise",
				"semaphore",
				"mutex",
				"typescript"
			],
			"author": {
				"name": "Emma Kuo"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/notenoughneon/await-semaphore/issues"
			},
			"homepage": "https://github.com/notenoughneon/await-semaphore#readme",
			"devDependencies": {
				"mocha": "^2.5.3",
				"typescript": "^1.8.10",
				"typings": "^1.3.1"
			},
			"gitHead": "b9f964ceb2eeb4865450b898eea2c01670ff2b05",
			"_id": "await-semaphore@0.1.0",
			"_shasum": "443995335656b4cf7f2a1f8053cccb1b97bc63e5",
			"_from": ".",
			"_npmVersion": "3.8.6",
			"_nodeVersion": "6.0.0",
			"_npmUser": {
				"name": "notenoughneon",
				"email": "emma.c.kuo@gmail.com"
			},
			"dist": {
				"shasum": "443995335656b4cf7f2a1f8053cccb1b97bc63e5",
				"tarball": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.0.tgz"
			},
			"maintainers": [
				{
					"name": "notenoughneon",
					"email": "emma.c.kuo@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "packages-12-west.internal.npmjs.com",
				"tmp": "tmp/await-semaphore-0.1.0.tgz_1469157303383_0.26671332586556673"
			},
			"directories": {},
			"contributors": []
		},
		"0.1.1": {
			"name": "await-semaphore",
			"version": "0.1.1",
			"description": "Awaitable semaphore/mutex",
			"main": "index.js",
			"scripts": {
				"prebuild": "typings install",
				"build": "tsc",
				"test": "mocha test.js"
			},
			"repository": {
				"type": "git",
				"url": "git+https://github.com/notenoughneon/await-semaphore.git"
			},
			"keywords": [
				"promise",
				"semaphore",
				"mutex",
				"typescript"
			],
			"author": {
				"name": "Emma Kuo"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/notenoughneon/await-semaphore/issues"
			},
			"homepage": "https://github.com/notenoughneon/await-semaphore#readme",
			"devDependencies": {
				"mocha": "^2.5.3",
				"typescript": "^1.8.10",
				"typings": "^1.3.1"
			},
			"gitHead": "be88742ea14a1114de566af1f71b538d66ea5793",
			"_id": "await-semaphore@0.1.1",
			"_shasum": "1f47882a27543612e2d0a07cc89fd024568d78c4",
			"_from": ".",
			"_npmVersion": "3.8.6",
			"_nodeVersion": "6.0.0",
			"_npmUser": {
				"name": "notenoughneon",
				"email": "emma.c.kuo@gmail.com"
			},
			"dist": {
				"shasum": "1f47882a27543612e2d0a07cc89fd024568d78c4",
				"tarball": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.1.tgz"
			},
			"maintainers": [
				{
					"name": "notenoughneon",
					"email": "emma.c.kuo@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "packages-12-west.internal.npmjs.com",
				"tmp": "tmp/await-semaphore-0.1.1.tgz_1469766262454_0.6407655684743077"
			},
			"directories": {},
			"contributors": []
		},
		"0.1.2": {
			"name": "await-semaphore",
			"version": "0.1.2",
			"description": "Awaitable semaphore/mutex",
			"main": "index.js",
			"scripts": {
				"prebuild": "typings install",
				"build": "tsc",
				"test": "mocha test.js"
			},
			"repository": {
				"type": "git",
				"url": "git+https://github.com/notenoughneon/await-semaphore.git"
			},
			"keywords": [
				"promise",
				"semaphore",
				"mutex",
				"typescript"
			],
			"author": {
				"name": "Emma Kuo"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/notenoughneon/await-semaphore/issues"
			},
			"homepage": "https://github.com/notenoughneon/await-semaphore#readme",
			"devDependencies": {
				"mocha": "^2.5.3",
				"typescript": "^1.8.10",
				"typings": "^1.3.1"
			},
			"gitHead": "dd377e3ab5d363947cdb79969bd1b6024a68f0ad",
			"_id": "await-semaphore@0.1.2",
			"_npmVersion": "5.3.0",
			"_nodeVersion": "8.4.0",
			"_npmUser": {
				"name": "notenoughneon",
				"email": "emma.c.kuo@gmail.com"
			},
			"dist": {
				"integrity": "sha512-3YKBzb5bXSmNNVbNrOCBP1ulNgaXq6O8bZk2n5rzAA4DgbFBgFvSlneMepptFesmUTZn3VzQlEEXYDYu0/+P9A==",
				"shasum": "0ceba1bdb2cfc537496032f167bd8b7dedb97493",
				"tarball": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.2.tgz"
			},
			"maintainers": [
				{
					"name": "notenoughneon",
					"email": "emma.c.kuo@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/await-semaphore-0.1.2.tgz_1504386989244_0.7936561787500978"
			},
			"directories": {},
			"contributors": []
		},
		"0.1.3": {
			"name": "await-semaphore",
			"version": "0.1.3",
			"description": "Awaitable semaphore/mutex",
			"main": "index.js",
			"scripts": {
				"prebuild": "typings install",
				"build": "tsc",
				"test": "mocha test.js"
			},
			"repository": {
				"type": "git",
				"url": "git+https://github.com/notenoughneon/await-semaphore.git"
			},
			"keywords": [
				"promise",
				"semaphore",
				"mutex",
				"typescript"
			],
			"author": {
				"name": "Emma Kuo"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/notenoughneon/await-semaphore/issues"
			},
			"homepage": "https://github.com/notenoughneon/await-semaphore#readme",
			"devDependencies": {
				"mocha": "^2.5.3",
				"typescript": "^1.8.10",
				"typings": "^1.3.1"
			},
			"gitHead": "f117a6b59324038c9e8ee04c70c328215a727812",
			"_id": "await-semaphore@0.1.3",
			"_npmVersion": "5.3.0",
			"_nodeVersion": "8.4.0",
			"_npmUser": {
				"name": "notenoughneon",
				"email": "emma.c.kuo@gmail.com"
			},
			"dist": {
				"integrity": "sha512-d1W2aNSYcz/sxYO4pMGX9vq65qOTu0P800epMud+6cYYX0QcT7zyqcxec3VWzpgvdXo57UWmVbZpLMjX2m1I7Q==",
				"shasum": "2b88018cc8c28e06167ae1cdff02504f1f9688d3",
				"tarball": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.3.tgz"
			},
			"maintainers": [
				{
					"name": "notenoughneon",
					"email": "emma.c.kuo@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/await-semaphore-0.1.3.tgz_1506547092661_0.11697156191803515"
			},
			"directories": {},
			"contributors": []
		}
	},
	"time": {
		"modified": "2017-09-27T21:18:12.733Z",
		"created": "2016-07-22T03:15:03.604Z",
		"0.1.0": "2016-07-22T03:15:03.604Z",
		"0.1.1": "2016-07-29T04:24:22.684Z",
		"0.1.2": "2017-09-02T21:16:29.318Z",
		"0.1.3": "2017-09-27T21:18:12.733Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "0.1.3"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"5fc87b28697f76a13ce2325a1540fb66\"",
			"fetched": 1598370739613
		}
	},
	"_distfiles": {
		"await-semaphore-0.1.0.tgz": {
			"url": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.0.tgz",
			"sha": "443995335656b4cf7f2a1f8053cccb1b97bc63e5",
			"registry": "npmjs"
		},
		"await-semaphore-0.1.1.tgz": {
			"url": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.1.tgz",
			"sha": "1f47882a27543612e2d0a07cc89fd024568d78c4",
			"registry": "npmjs"
		},
		"await-semaphore-0.1.2.tgz": {
			"url": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.2.tgz",
			"sha": "0ceba1bdb2cfc537496032f167bd8b7dedb97493",
			"registry": "npmjs"
		},
		"await-semaphore-0.1.3.tgz": {
			"url": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.3.tgz",
			"sha": "2b88018cc8c28e06167ae1cdff02504f1f9688d3",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"await-semaphore-0.1.3.tgz": {
			"shasum": "2b88018cc8c28e06167ae1cdff02504f1f9688d3"
		}
	},
	"_rev": "17-614219119c06c2bc",
	"_id": "await-semaphore",
	"readme": "# await-semaphore\nAwaitable semaphore/mutex\n\nA semaphore implementation using ES6 promises and supporting 3 styles:\n\n* async/await style (needs typescript)\n* thunk style (automatic acquire/release)\n* promise style\n\nAlso includes `Mutex` as a convenience for `new Semaphore(1)`.\n\n## API\n\n### new Semaphore(count: number)\n\nCreate a new semaphore with the given count.\n\n```javascript\nimport {Semaphore} from 'await-semaphore';\n\nvar semaphore = new Semaphore(10);\n```\n\n### semaphore.acquire(): Promise<() => void>\n\nAcquire the semaphore and returns a promise for the release function. Be sure to handle release for exception case.\n\n```javascript\nsemaphore.acquire()\n.then(release => {\n    //critical section...\n    doSomething()\n    .then(res => {\n        //...\n        release();\n    })\n    .catch(err => {\n        //...\n        release();\n    });\n});\n```\n\n### semaphore.use<T>(thunk: () => Promise<T>): Promise<T>\n\nAlternate method for using the semaphore by providing a thunk. This automatically handles acquire/release.\n\n```javascript\nsemaphore.use(() => {\n    //critical section...\n});\n```\n\n### new Mutex()\n\nAn alias for `new Semaphore(1)`. Mutex has the same methods as Semaphore.\n\n```javascript\nimport {Mutex} from 'await-semaphore';\n\nvar mutex = new Mutex();\n```\n\n## Examples\n\nCreate a version of `fetch()` with concurrency limited to 10.\n\n### async/await style (typescript)\n\n```typescript\nvar semaphore = new Semaphore(10);\n\nasync function niceFetch(url) {\n    var release = await semaphore.acquire();\n    var result = await fetch(url);\n    release();\n    return result;\n}\n```\n\n### thunk style (javascript)\n\n```javascript\nvar semaphore = new Semaphore(10);\n\nfunction niceFetch(url) {\n    return semaphore.use(() => fetch(url));\n}\n```\n\n### promise style (javascript)\n\n```javascript\nvar semaphore = new Semaphore(10);\n\nfunction niceFetch(url) {\n    return semaphore.acquire()\n    .then(release => {\n        return fetch(url)\n        .then(result => {\n            release();\n            return result;\n        });\n    });\n}\n```"
}