{"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":{"integrity":"sha512-M+DEXNK2QoH0NcYQx6NTVKTfjxgXhIkC4N+bHVmT9MBnejIDaBJ3uU/gr1gm8Mzl4App/OatAT6jZj+w2wDjcA==","shasum":"9b5a53c4f01d87841c1d2907ac8d6609124d8d68","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-0.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\nwsFcBAEBCAAQBQJdegwRCRA9TVsSAnZWagAATHEQAJSDYB8za4ZsNkUqg8Fz\n4013RSnsM0FV3rIzN0/oet22eQQ7HbykeazmMF3pI8QeKmnxm4Ptm3+LU0s5\nuBSSASr4mptgStQ1GJ/XxHy3xq3b0P996r6bYUqpkMp3cKFnmBWbeGC6LYFb\n7D7AbYhQkDPNzCveaLzbEnLquXLsqqhZ+s33zb9WJmj3MVRgMka5LJT6U7I8\nYGjtTVSGwZ7k7A8B41QwcOB82IfbYdRiOH62RvuiKY/VwGxHOfGO3aIR2Gsy\nHPu5OXK30aIT3w/KzXoO+Zp23jQpnnMx/BsJ42Q+/TBC9/9ClbdODtSv7T3z\n6KhzqlVSmRh+zqm+veUiwclyX5ivgnjcrO8NxCRouLo7A78AexVqbxABx9hw\nh1/JkjcGZThbFns4KcrVP3/eU+f6POHSPTkBOr4lnBoJd5Zp2MOJCfOgg2px\nR2+qAv/dV7oR3fZ2/mkDJPwnBcBiYMgvREiG8Mh1gPPz0qWNg3jkTkdC1ahY\nplgraNm+yGL+sdMbWTEDKE6v5xRYFpGaJFICzu7oN4+Zx5x3B200vsDkMSbq\nOBOcihpXekpF524xJW1QIz9zs7UqWYjLRwJDLNDFk2ze2ujM2Z0O8tYZH1NX\nJ63tZXOxPo8XVndg1a1rjAkTEHIf6/BalZYPty0w5JamSL6Ao32d06hRCKYz\n6wuH\r\n=e3R/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCac+jrArPSvqvvBTZyGYHSKDWgxy6W4EegaU6scUarngIgQ2aT6x0mnY1XAJUSwVgtGGFwQEpPWMeY49AECiPa/vU="}],"size":1957,"noattachment":false,"key":"/nanoguard/-/nanoguard-0.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_0.0.0_1568279568420_0.43489717333305"},"_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":1568279568593,"_cnpm_publish_time":1568279568593,"dist-tags":{"latest":"1.3.0"}}