{ "_args": [ [ { "raw": "lock@^0.1.2", "scope": null, "escapedName": "lock", "name": "lock", "rawSpec": "^0.1.2", "spec": ">=0.1.2 <0.2.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/@expo/ngrok" ] ], "_from": "lock@>=0.1.2 <0.2.0", "_id": "lock@0.1.4", "_inCache": true, "_location": "/lock", "_nodeVersion": "7.7.4", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/lock-0.1.4.tgz_1499949795813_0.7141403153073043" }, "_npmUser": { "name": "raymondmayjr", "email": "raymondmay@gmail.com" }, "_npmVersion": "4.1.2", "_phantomChildren": {}, "_requested": { "raw": "lock@^0.1.2", "scope": null, "escapedName": "lock", "name": "lock", "rawSpec": "^0.1.2", "spec": ">=0.1.2 <0.2.0", "type": "range" }, "_requiredBy": [ "/@expo/ngrok", "/lru-memoizer" ], "_resolved": "https://registry.npmjs.org/lock/-/lock-0.1.4.tgz", "_shasum": "fec7deaef17e7c3a0a55e1da042803e25d91745d", "_shrinkwrap": null, "_spec": "lock@^0.1.2", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/@expo/ngrok", "author": { "name": "Dominic Tarr", "email": "dominic.tarr@gmail.com", "url": "http://dominictarr.com" }, "bugs": { "url": "https://github.com/dominictarr/lock/issues" }, "dependencies": {}, "description": "lock asynchronous resources.", "devDependencies": { "tape": "~0.2.2" }, "directories": {}, "dist": { "shasum": "fec7deaef17e7c3a0a55e1da042803e25d91745d", "tarball": "https://registry.npmjs.org/lock/-/lock-0.1.4.tgz" }, "gitHead": "94284d24ad8d297edad2505bc62ee93950f79d37", "homepage": "https://github.com/dominictarr/lock", "license": "MIT", "maintainers": [ { "name": "raymondmayjr", "email": "raymondmay@gmail.com" }, { "name": "dominictarr", "email": "dominic.tarr@gmail.com" } ], "name": "lock", "optionalDependencies": {}, "readme": "# lock\r\n\r\nlock asynchronous resources.\r\n\r\n## Simple Example\r\n\r\n``` js\r\nvar Lock = require('lock')\r\nvar lock = Lock()\r\n\r\nlock('key', function (release) { //called when resource is available.\r\n\r\n //do an async operation, and wrap the callback with release.\r\n someAsyncOperation(args,..., release(function (err) {\r\n //'key' is now unlocked!\r\n })\r\n})\r\n```\r\n\r\n## Multiple Locks at Once.\r\n\r\n``` js\r\nvar Lock = require('lock')\r\nvar lock = Lock()\r\n\r\nlock(['A', 'B', 'C'], function (release) { //called, when ALL\r\n //resources are available.\r\n\r\n //do an async operation, and wrap the callback with release(cb)\r\n someAsyncOperation(args,..., release(function (err) {\r\n //A, B & C are now unlocked!\r\n })\r\n})\r\n```\r\n\r\n## Lock with optional callback.\r\n\r\n``` js\r\nvar Lock = require('lock');\r\nvar lock = Lock();\r\n\r\nlock('cache', function(release) { //called when no one is writing to cache\r\n\t//we do not care if this fails since its a cache so no callback needed\r\n\tfs.writeFile(fileCache, ... , release())\r\n})\r\n```\r\n\r\nused in [level-update](https://github.com/dominictarr/level-update)\r\n\r\n## License\r\n\r\nMIT\r\n\r\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git://github.com/dominictarr/lock.git" }, "scripts": { "test": "set -e; for t in test/*.js; do node $t; done" }, "types": "index.d.ts", "version": "0.1.4" }