{"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":{"integrity":"sha512-zac2XVUUN1qJiwgpvPhavmeqAXNy59LGQHt6jNyxuNzBYwSyRAW7tAbwXmiBplXXdcnwvGuofz8QsF1H5xjKyQ==","shasum":"e10fe1d0f8df75b7d09f5dffe183c36ae1b18509","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-1.1.0.tgz","fileCount":6,"unpackedSize":4933,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdehheCRA9TVsSAnZWagAAsB4P/1a3ZRoaNxOyJCIZIOlF\neZMDzCkMt6QilXmNK/RSz7adNUHXVTwPCMcxKg7kTlvMsRnHG1N604UMUXnG\nwieyqZ8TZjuTP3RFJF6SObTaG66E38u6a7OjW49IqMs1T4QfMGayiMAj4y4Y\nwN9ZpNNc7Nu7xqXQdiqjImLjgyYK/RHw59gc04Jca1TzDlltCAtSN14R2ROn\nx9y05RuSHoieAHkO5ZPfyQgjwiWgDGYe7wA3KDYft59vWqW0GAilz+6pwcJz\ncM31G0z3wq+vHsX6Mta0O797SUEw9KMPOxkJGC/vZAmStIBV+oBmG4iQUaTF\nPZZZw+c3r89bEs1Y3frZSr0/qU5gL/dnN8XMyd6zdRb2Benx0feMjEwHIOXg\n3O2ueM6xbVSU0vIziZ9ExRX8iRFX94XHkB3Cnp+K9xwOimJb1C882ogH11zL\neVFEYE17K97kzBaQmD4OnPjw0nvbomgo5BIBvmNK9WfMZX46db+rKGhWBq5s\nGZ040nCiUVYitmGF2SMgmwvUZy+o58A7dorM21QuQnalRPMBl8DpzhMzuVsr\nhWtN/JsaFe/1c3/JrhxDVNTJHT4Kj9x9KSoIpPJ87Pbs2ICMnDtGCs5/1W1F\nSgQYm9Xfmg60HBh7MQb7hLPoBUGFy9KPJzcquCj9yHwaoWcpWwerFDDRcDsj\nlLZY\r\n=fzvY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNan3gcSP2xy9rHMSUyv838q6vvf2JMOrohTsnX9f3oQIgP3qnqfOMUm8SfmvWK6ZMEsfmLQpUcXd5j9pAIOcg7OI="}],"size":2185,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.1.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.1.0_1568282717681_0.7737269550746302"},"_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":1568282717805,"_cnpm_publish_time":1568282717805,"dist-tags":{"latest":"1.3.0"}}