{"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":{"integrity":"sha512-XowCxURA68arCQEypYKAxyIvBUP2EkqA8mZCXqJ2yzLpFblxSjiP06PUUpVK2no3cgGhsbRlBrsEuYIflxu79w==","shasum":"944c6c8d11a20cf882d0d82062e1f2761103167b","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-1.2.1.tgz","fileCount":6,"unpackedSize":5520,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdejNTCRA9TVsSAnZWagAAxbcQAJJ1d829xQVcKyRFh/uD\nEHAxyTMLarvaaTA+vwsG8joVrwzQv5EHvDoTP8/Y6o+tf3twX4jcNHplFLlU\nYHPP4lfhcxsQGIKuxN+m53bVs8cd66RBsT34NeXFTI+x1+Ts1A0qtIXv9m8r\nr0od6CuavNlH62YlkQ6Plqs1BXQxj5Z/02yP0zG+uIcsX0xdfhZ3ZwgiblCQ\ncW9oRD5yISctt1r++VVUKUC7lrsY15/DxubGi5nwQogWP2cCIhKixPrE5h25\nz0JAAnJy9XakGwhqUXDCjwiUnNzBdR1Y4BzklciU311GqWIM9Or1/b/2WBuS\nDHa/X5jtkI7pwMWbO2DCDAo2AWw/waZmLV6lcZrLkxI6hPDl/97MpAUXjRUj\nVgD2ffr61a9Mvu7zkK5bOINByPdRC1NAtBElX2JRy5U3wxmICenR2GS/aCwI\nvRKsRUET61J91HNCIdoXLDfZLPxMS+2qePKhvo/p3WlrsFSAu7be3pXuUfkE\nxtwlWXJpelCK5Q4nCZyUftD2Sii6Rhn1Bm57qdMQGtUKU+w2VfAxbW3Fzj9T\nmxQ6o4+sswrSNg/qBTIsth2/7fU/NOg5qnrEt9ZI6pYu1Vn+M/s1tLQ5+rp2\nH3FuXCSdEftaylsi/XZ1XIxOTjCi5S8CkgL3FM0f8rZ8AVx3nmcSzPm2C3au\naAmN\r\n=+/vD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDq3z8ee6WMEFz9jIDfGrQNSmuZ4G9sWbuUDFmK2YY+PAIhAM+4LaVfsw0DWGgA39lhDg25sD2rBXu/HqWLAee5XuD8"}],"size":2321,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.2.1.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.2.1_1568289619231_0.5002808751154533"},"_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":1568289619350,"_cnpm_publish_time":1568289619350,"dist-tags":{"latest":"1.3.0"}}