{"_id":"nanoguard","_rev":"480971","name":"nanoguard","description":"Small module that allows you to guard a call to a function.","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-08-05T09:36:54.000Z","created":"2019-09-12T09:12:48.593Z","1.3.0":"2020-02-14T14:30:25.455Z","1.2.2":"2019-11-10T16:42:14.542Z","1.2.1":"2019-09-12T12:00:19.350Z","1.2.0":"2019-09-12T11:07:09.253Z","1.1.0":"2019-09-12T10:05:17.805Z","1.0.0":"2019-09-12T09:13:11.646Z","0.0.0":"2019-09-12T09:12:48.593Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"versions":{"1.3.0":{"name":"nanoguard","version":"1.3.0","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"b9dff083b85af12abf8aae14bc0ff12fbda0d3cb","_id":"nanoguard@1.3.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"shasum":"9b38a2a69f30a848f8ed1e4f0dabee8ff506e54c","size":2537,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.3.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.3.0_1581690625345_0.1512940042352504"},"_hasShrinkwrap":false,"publish_time":1581690625455,"_cnpm_publish_time":1581690625455},"1.2.2":{"name":"nanoguard","version":"1.2.2","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"f0258d2ac4ef0dffecacad3c57b1801e6fd0a708","_id":"nanoguard@1.2.2","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"shasum":"a2069c563600a1853fd3ec31ed11e9681aa3dd80","size":2379,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.2.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.2.2_1573404134409_0.09362004505127519"},"_hasShrinkwrap":false,"publish_time":1573404134542,"_cnpm_publish_time":1573404134542},"1.2.1":{"name":"nanoguard","version":"1.2.1","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"3a525a0249a17c395eef7894bd6598d08c7f7951","_id":"nanoguard@1.2.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"944c6c8d11a20cf882d0d82062e1f2761103167b","size":2321,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.2.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.2.1_1568289619231_0.5002808751154533"},"_hasShrinkwrap":false,"publish_time":1568289619350,"_cnpm_publish_time":1568289619350},"1.2.0":{"name":"nanoguard","version":"1.2.0","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"f86342953db7835b2fbe7a748202de87b74eb890","_id":"nanoguard@1.2.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"befecea9de80e6619ea98180b59485a9cbb285ce","size":2283,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.2.0_1568286429127_0.1326524110318954"},"_hasShrinkwrap":false,"publish_time":1568286429253,"_cnpm_publish_time":1568286429253},"1.1.0":{"name":"nanoguard","version":"1.1.0","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"f51b2772e486c7e0791b044b24cb6065c9ef50a2","_id":"nanoguard@1.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"e10fe1d0f8df75b7d09f5dffe183c36ae1b18509","size":2185,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.1.0_1568282717681_0.7737269550746302"},"_hasShrinkwrap":false,"publish_time":1568282717805,"_cnpm_publish_time":1568282717805},"1.0.0":{"name":"nanoguard","version":"1.0.0","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"215aecceb6b48ad5c7449b37502eb1ebc86c56c3","_id":"nanoguard@1.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"be0201d8c7f6e54b4debe65eb7f40fea1c08cdee","size":1958,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_1.0.0_1568279591511_0.17709790305653605"},"_hasShrinkwrap":false,"publish_time":1568279591646,"_cnpm_publish_time":1568279591646},"0.0.0":{"name":"nanoguard","version":"0.0.0","description":"Small module that allows you to guard a call to a function.","main":"index.js","dependencies":{},"devDependencies":{"standard":"^14.2.0","tape":"^4.11.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nanoguard.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"homepage":"https://github.com/mafintosh/nanoguard","gitHead":"2821abe9cf3c50775121e960ebdf296ed1284180","_id":"nanoguard@0.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"9b5a53c4f01d87841c1d2907ac8d6609124d8d68","size":1957,"noattachment":false,"key":"/nanoguard/-/nanoguard-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nanoguard/download/nanoguard-0.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nanoguard_0.0.0_1568279568420_0.43489717333305"},"_hasShrinkwrap":false,"publish_time":1568279568593,"_cnpm_publish_time":1568279568593}},"readme":"# nanoguard\n\nSmall module that allows you to guard a call to a function.\n\n```\nnpm install nanoguard\n```\n\n## Usage\n\n``` js\nconst Nanoguard = require('nanoguard')\nconst guard = new Nanoguard()\n\nguard.wait()\n\n// When the amount of wait() calls reflect continue() calls ready is called\nguard.ready(function () {\n  console.log('Ready to continue!')\n})\n\nguard.continue()\n```\n\n## API\n\n#### `const guard = new Nanoguard()`\n\nMake a new guard instance\n\n#### `guard.wait()`\n\nIncrement the wait counter.\nNon-owners of the guard can use this to defer the ready function of the guard owner.\n\n#### `guard.continue()`\n\nDecrement the wait counter on the next tick. If the counter is `0` it calls all pending\nready functions.\nIf you called wait() you have to call continue() at some point.\n\n#### `guard.continueSync()`\n\nSame as `guard.continue()` but decrements in the same tick.\n\n#### `const cont = guard.waitAndContinue()`\n\nCalls wait and returns a function that when called calls continue() once no matter how many times it is called.\n\n#### `guard.ready(fn)`\n\nPass a function that is called when the wait counter is `0`.\n\n#### `guard.destroy()`\n\nForce sets the wait counter to `0` forever.\nShould only be called by the owner of the guard.\n\n#### `const bool = guard.waiting`\n\nBoolean indicating if the wait counter is `> 0`.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/nanoguard","bugs":{"url":"https://github.com/mafintosh/nanoguard/issues"},"license":"MIT"}