{"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":{"integrity":"sha512-B4aSs/onfJU0tngZHttvWEhrPSoxvVpjnJHVTsCBM1s7So1ksbtzdcr8ImvoQLbaF9vMMBIm6CoSZ7WW7kv5+Q==","shasum":"befecea9de80e6619ea98180b59485a9cbb285ce","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-1.2.0.tgz","fileCount":6,"unpackedSize":5268,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdeibdCRA9TVsSAnZWagAAmK8P/37iIjinQgpaNbupIKrq\nYYIc03cCXJFUd+Tz/5puzepXSxLrqYlNQg+Y9ygmy79DRGe0aWM98ShCNrUE\nywPja1WYxIv09Gk+MDLFpchOTHIYwVLmM0Z1XF7Lewap8CKAYAHGfcIXfUKJ\nppLeIK5Kn0JLjOh5cPvGcFT19o/vmVl65lrhxged32qd1vc08MLRRwtpwh7B\nQXRZHP8gZ8de5EYOCG0Goz47keOd/rUHagXqEmNOmJJBPDbGcg6l2oT91TSX\n/vy4Ikat6qYgxY6ZgzY3x/X3f6i0hrp1dtGmB3ckykXI9c/Rxe+1mYdOi/EG\nqEDuwDM9LO2gizsPm+m2IcLEI3J4AB+3qX4INO537ioZUVnzThzgXWzXkOvE\ns2QEZsgt+qZ1SAmwr2ai9Fdi7wq16bmME4fYM5OgXR4oLRC+nVimtDjZvuy2\nF5evvtByP/QDHj3WzOjdSRtfoC0Pa1A4GPLpx4kgqesDEfFgWi0pPk6B5Os0\ngwP2gcRvdaHgMFTLKfnCKXY6lvkA1ArIZhqCOIm3d6I9ItVDI4Mvcc/+NT8Z\n7nZHDgDVKTDm3p+FRobWERmJjpzSMZ84U0Tv886FLonmSrKpXXLl+fmAUBc4\ns2A745UQVXB9w9QNBDVWIKFnRfKp8fUCi34ijijiUaa6I5UYd/lW2hAHalnB\nXS8N\r\n=F+iC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYyAV5ui3Cdoj5E8e8WnhR2Bnd6I2fZvJ7YGPQtIIv6AIhAOz3+HP3GwhjpkDUmDSCXSsHowcVUHE6LQVvJDkOtDsw"}],"size":2283,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.2.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.2.0_1568286429127_0.1326524110318954"},"_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":1568286429253,"_cnpm_publish_time":1568286429253,"dist-tags":{"latest":"1.3.0"}}