{"_id":"lockmap","maintainers":[{"name":"null_radix","email":"null_radix@riseup.net"}],"keywords":[],"dist-tags":{"latest":"0.1.1"},"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"description":"Creates a promise based map of locks that can be used as a semaphore","readme":"# SYNOPSIS :lock: :globe_with_meridians: \n\n[![NPM Package](https://img.shields.io/npm/v/lockmap.svg?style=flat-square)](https://www.npmjs.org/package/lockmap)\n[![Build Status](https://img.shields.io/travis/wanderer/lockmap.svg?branch=master&style=flat-square)](https://travis-ci.org/wanderer/lockmap)\n[![Coverage Status](https://img.shields.io/coveralls/wanderer/lockmap.svg?style=flat-square)](https://coveralls.io/r/wanderer/lockmap)\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)  \n\nCreates a promise based map of locks that can be used as a semaphore\n\n# INSTALL\n`npm install lockmap`\n\n# USAGE\n\n```javascript\nconst LockMap = require('lockmap')\n\nconst lockmap = new LockMap()\nconst id = 'test'\n\n// set a lock for an id\nconst unlock = lockmap.lock(id)\n\nsetTimeout(() => {\n  // do some async work\n  console.log('here first!')\n  unlock()\n}, 300)\n\n// wait until the lock resolves\nawait lockmap.get(id)\nconsole.log('here now!')\n```\n\n# API\n\n-   [constructor](#constructor)\n-   [lock](#lock)\n-   [getLock](#getlock)\n\n## constructor\n\n[index.js:5-7](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L5-L7 \"Source code on GitHub\")\n\nCreates a new instance of LockMap\n\n## lock\n\n[index.js:15-25](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L15-L25 \"Source code on GitHub\")\n\nCreates a lock on a given ID and returns a resolve function to unlock the\nlock\n\n**Parameters**\n\n-   `id` **any** \n\nReturns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the resolve function to call once it to unlock\n\n## get\n\n[index.js:32-34](https://github.com/wanderer/lockmap/blob/01587eaf141302ad9c7d7c412205e3c0188dcd49/index.js#L32-L34 \"Source code on GitHub\")\n\ngets the current lock if any for a given id. If there is a lock this will\nreturn a promise that resolves once the lock is unlocked\n\n**Parameters**\n\n-   `id`  \n\nReturns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** \n\n# LICENSE\n[MPL-2.0][LICENSE]\n\n[LICENSE]: https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)\n","repository":{"type":"git","url":"git+ssh://git@gitlab.com/mjbecze/lockmap.git"},"bugs":{"url":"https://gitlab.com/mjbecze/lockmap/issues"},"license":"MPL-2.0","versions":{"0.1.1":{"name":"lockmap","version":"0.1.1","description":"Creates a promise based map of locks that can be used as a semaphore","main":"index.js","scripts":{"coverage":"nyc npm test","coveralls":"npm run coverage && nyc report --reporter=text-lcov | coveralls","lint":"standard","test":"node ./tests/index.js","build:docs":"documentation build -f md ./index.js > ./docs/index.md"},"keywords":[],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","dependencies":{},"devDependencies":{"coveralls":"^3.0.5","documentation":"^12.0.3","nyc":"^14.1.1","standard":"^13.1.0","tape":"^4.11.0"},"repository":{"type":"git","url":"git+ssh://git@gitlab.com/mjbecze/lockmap.git"},"bugs":{"url":"https://gitlab.com/mjbecze/lockmap/issues"},"homepage":"https://gitlab.com/mjbecze/lockmap","gitHead":"1fadac0f9cd5969c2669f6dd96fe99dfcfd36541","_id":"lockmap@0.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-q4pucTlxZLL8dZe7E7aTowJ3tNniHFefC6tpQRwU8LSYXxNTBvBeMUwUUin89ZnX74L7p9yXh0PYf2EUImFf6w==","shasum":"f4bf20ea29cb1f0cb1d2343352d2d8e57232c70b","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/lockmap/-/lockmap-0.1.1.tgz","fileCount":23,"unpackedSize":3231929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdOiQSCRA9TVsSAnZWagAA/x0P/RiU0io64fzH42ik9DOb\nLlVAtZyAaszO1vfT7R+i+Ql6AB6jhQwOEqAn2D20AS6nIplR9i6gxMe1o9XS\ncj/fHyRzdO8WTJMFAFA+jyNs+YGiPxfyt5trG9yqMPNKFdv7eNdb16IxVFaf\ncRJ4kBImBRsP8bjSgLtyAFtlo5uKubLqKIwiny4YbPpYuKl6nDLeQN82N6IC\nZ6HK62XkMMZGEXTMnrS70OLmOpc5YdoFXKGNkIRDy02LDggYSOtkBiuPNWof\nG0m+JC4vG8VQFovlEF+AVeSICFshmDsJXYPhm4HIHhNttAcLJhnlJM+rmWZZ\nawHVv/8lzdsrT+edq47/qf988e0sWZWxnaPNWCH7cxnw+p+x1bjjlQ1nF9dX\nvoP4qhsS5d3mGLcQlgCoGOzM18MPGKhTDa4hPyvJn8c70ljCHh/qEUssuUq7\naBKnGUVLksIb1kN05ySiBpjtrZtGxYkRiVfoP7+WBpz3P6DuI7MxdQTj/Ap9\npUHSi9BRM2lBQoE+okSll4S+dLDdYv9MmkWNTNE2/FiA1hjBOWVNQwJiKm1r\noryMSFagYF1g9Pz6M+qP7a0fT6fTlaoL8taNpHLGrUHwGyfcN2vJDJJwq/Fe\nUN9zF3SInBkc/EqqwTuxBjKlP8L2e7EGzfU22gM4s7oPBlZT8nV1YINHDfAv\nDsUT\r\n=p5BE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFcENw7jQNR+fnTkY+9pRBZYm6IcO1few7ol+exWihz1AiAhJgH40k93+Ur08cuqYPgK8OfO1WJ7eS3mnOuFYjWkEQ=="}]},"maintainers":[{"name":"null_radix","email":"null_radix@riseup.net"}],"_npmUser":{"name":"null_radix","email":"null_radix@riseup.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lockmap_0.1.1_1564091409916_0.4224640133077131"},"_hasShrinkwrap":false},"0.0.0":{"name":"lockmap","version":"0.0.0","description":"Creates a promise based map of locks that can be used as a semaphore","main":"index.js","scripts":{"coverage":"istanbul cover ./tests/index.js","coveralls":"npm run coverage && coveralls <coverage/lcov.info","lint":"standard","test":"node ./tests/index.js","build:docs":"documentation build --github  -f md ./index.js > ./docs/index.md"},"keywords":[],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","dependencies":{},"devDependencies":{"coveralls":"^2.11.4","documentation":"^5.2.0","istanbul":"^0.4.1","standard":"^10.0.0","tape":"^4.0.3"},"repository":{"type":"git","url":"git+ssh://git@github.com/wanderer/lockmap.git"},"bugs":{"url":"https://github.com/wanderer/lockmap/issues"},"homepage":"https://github.com/wanderer/lockmap","gitHead":"312a9e92ae190072536e09e92aa1181cfd3ad430","_id":"lockmap@0.0.0","_shasum":"74b19167a01eb9b09051af8419fa70c047b6e120","_from":".","_npmVersion":"4.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"null_radix","email":"null_radix@riseup.net"},"dist":{"shasum":"74b19167a01eb9b09051af8419fa70c047b6e120","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/lockmap/-/lockmap-0.0.0.tgz","integrity":"sha512-UfkbUsxd05rm2E86nXa3aRVCV7Yi+JNtNAXvJByxrhSg7fmOPRgvekPhtaC9KeRn6fMR8Ud5oQqIjNG1t75BUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDReMnO5lNsxcwqRHDcjzvUY2o7O3QHzrNptd5M5+OVAAiA1ypGQHDO6x4MPf/4duuOLpdFLLR3KRdZx9xTVGN3dkA=="}]},"maintainers":[{"name":"null_radix","email":"null_radix@riseup.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lockmap-0.0.0.tgz_1502900319095_0.1436591143719852"},"directories":{}},"0.1.0":{"name":"lockmap","version":"0.1.0","description":"Creates a promise based map of locks that can be used as a semaphore","main":"index.js","scripts":{"coverage":"nyc npm test","coveralls":"npm run coverage && nyc report --reporter=text-lcov | coveralls","lint":"standard","test":"node ./tests/index.js","build:docs":"documentation build --github  -f md ./index.js > ./docs/index.md"},"keywords":[],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","dependencies":{},"devDependencies":{"documentation":"^5.3.3","coveralls":"^3.0.0","nyc":"^11.3.0","standard":"^10.0.0","tape":"^4.0.3"},"repository":{"type":"git","url":"git+ssh://git@github.com/wanderer/lockmap.git"},"bugs":{"url":"https://github.com/wanderer/lockmap/issues"},"homepage":"https://github.com/wanderer/lockmap","gitHead":"742e5b44be0c30a90bd21fcc84bffd83ab6974b2","_id":"lockmap@0.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.8.1","_npmUser":{"name":"null_radix","email":"null_radix@riseup.net"},"dist":{"integrity":"sha512-/oBR2STEZ0e0lyB9ZfHnk4GkfgfWP4PXPt4h0eXYItJl3YIvXhHcVUvwhJlJLCTSLquoM+RvyvZYXar4l6fugA==","shasum":"7221a87fb0db3aa09163d388b5d2aa4a67097b78","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/lockmap/-/lockmap-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGQvCYTywYBCvgvON+Ulu9xsQAsBLnTuvgdzDP9EYFwAIgeZUzpzJBBs7Z/SGDA0Lm/ULkCxRY9Fe+v/7J0Rh+kN4="}]},"maintainers":[{"name":"null_radix","email":"null_radix@riseup.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lockmap-0.1.0.tgz_1510958187755_0.7606047964654863"},"directories":{}}},"name":"lockmap","time":{"created":"2017-08-16T16:18:40.153Z","modified":"2025-05-13T08:42:35.039Z","0.1.1":"2019-07-25T21:50:10.019Z","0.0.0":"2017-08-16T16:18:40.153Z","0.1.0":"2017-11-17T22:36:27.863Z"},"readmeFilename":"README.md","homepage":"https://gitlab.com/mjbecze/lockmap"}