{"name":"nanoguard","version":"1.3.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":"b9dff083b85af12abf8aae14bc0ff12fbda0d3cb","_id":"nanoguard@1.3.0","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-K/ON5wyflyPyZskdeT3m7Y2gJVkm3QLdKykMCquAbK8A2erstyMpZUc3NG8Nz5jKdfatiYndONrlmLF8+pGl+A==","shasum":"9b38a2a69f30a848f8ed1e4f0dabee8ff506e54c","tarball":"http://registry-npm.ywwl.com/nanoguard/download/nanoguard-1.3.0.tgz","fileCount":6,"unpackedSize":6493,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRq8BCRA9TVsSAnZWagAAMj4QAJmovn9HNF7TVht96Jwi\nxV3QEI9iG3DyAamcUg819M/rowzVhF4cvvNfqXLls+IeNorGrrLLB711H6KA\nRKbeyMbGz6mNQoRgY6MGA3hWb8rEc0Wj+BNwtNBlX7dNrmt3LpNyhBWgxyzk\nx0ru+wJdobSIhQsT3rQdqniWXZPYKli3E/I8bZKjIzaHN8jS2mIJidXSfQJS\n7xCTq71+aQOsl5eTFO2fkX94HIOcXCb5SmEKZUsdQOIFkAVQY+nKXhjCjeP2\neW90t/xUu31SC759iNTzHPK/I5XioylnpPx0P4MYOKl9m5WSNrFZXCVXXwOq\nQSSQo0V3CJ6iFPnhdbd1u7Q1PvBcCPZ5ApnWngD5WHq9LEmlXpD86UttDRGH\n6TVyRGah6lMNYq/hU1/w7i5UijJJ/AJRXC94d6xOYCWpXowz1FMjIOqnGVNn\nrmSaFvdb86NBS/Wty8hXRikZ2m/tdf/h/+H7Bf9qKfnhjzFEHkrMgx2j1SQL\njtEmBQGIJNmTGfYlw/gegjVYoVz+nZpCS991/ToronQJegARzlWU5vmRP21Y\n17f6iDj2OooAQ/wodwc8iGXgMAsaKPLEoxvpj4BN2nsre7FgIKhOSmbjKdMN\n9lwjoxHWtSoIBeYi9rb6ILX+EHLk+OwyYTHbBkoB4CT7Thj9VtCAzm+fh1a8\njYqX\r\n=hXbG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0OW2lLebPQnjfEFnp1JmvfRrQsrTfxE6/rKzJkaaC2AIhANSHJQyWTT17Nom0B8l2e/66QKJVzcgB9nOTLR/TPZ/z"}],"size":2537,"noattachment":false,"key":"/nanoguard/-/nanoguard-1.3.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.3.0_1581690625345_0.1512940042352504"},"_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":1581690625455,"_cnpm_publish_time":1581690625455,"dist-tags":{"latest":"1.3.0"}}