{"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":{"integrity":"sha512-AjloJc/b4ggn28/KTdSHgWFyE+JA1T2hs7jJuxn0FAmtcUwhmYZvmMCTUH0QqlBBc+XgRgRufnQ3WL8Rmg9ICw==","shasum":"be0201d8c7f6e54b4debe65eb7f40fea1c08cdee","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-1.0.0.tgz","fileCount":6,"unpackedSize":4202,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdegwoCRA9TVsSAnZWagAAuQoQAJrTKgCxc4oEnFUYcn81\nA9rqXcOgT7/qSXSDBLgJo+wJFY41ToDdb5xw/EiFBvBkoK9O+hOFEMCewyPW\nGr10is7bmqen3xpIo1yjD0yHq/uEK8sqOje/X4QkQP8JKshIsdhoAUnKh4D1\nRpuLjQZAkV+7lyZwPAB6OUKFBxUaK4q87IVpSC4dgChYvVC6aIDzFv1jX4gm\nrPNk7TWp5ek6wVJETDby9+mmLX9YqEkMl5cVVrPF3DVoaTAbycqHmXNeLU6U\nxpJe/MRIWAb2jjxMZsWXw56MBAUIxrghapSeRwnA2yxEikEEYpXSl6QR2yb2\nTM9y7alfYNRlPiqphE7q7HbQHOQJb6BhdRBLkck0Y0rvmq4FLEbR14Itfy4j\nBde1Hhn0NpimFVHIYOBk+rHkHDSUxzRD3SciArlIeiPPqMSfJcpppsyVnmAh\nUJCj3bZDIC+BLv4xnzlek8hwkwOlC7CJ1sF2GwAdG+qlrIIjMlOYgo8pvpRr\nxwiAhdytq0Q+aSiIZXjlTN9NNmsOVVZjFxrIGvxleYjzPA4Y18R002Y1rb1d\n1P/yWDXQdsGspr3FTFLUXQxWb7tD/ZdkyJJ0zUSCRu58KMnpaz7FA1mXdpQK\n6d1m4m6VEsuxl8WCkgocj5Cc7XclxXKh6p9K55DcQ742ul6UkpTL3Dg1ydwW\nIMw8\r\n=j47A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICgF+UCEzz9wxrgD+Vzi7Yzmj+5lJeLy3/ntk5AnV5rhAiEAw/pL4SB4IezVthqb9TO2cRmsN4is4/HRTpZ+A5vWG9E="}],"size":1958,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_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,"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","publish_time":1568279591646,"_cnpm_publish_time":1568279591646,"dist-tags":{"latest":"1.3.0"}}