{"name":"last-one-wins","version":"1.0.3","description":"Make sure the last sync call to an async function is executed after all previous ones have finished","main":"index.js","dependencies":{},"devDependencies":{"standard":"^5.4.1","tape":"^4.2.2"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/last-one-wins.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/last-one-wins/issues"},"homepage":"https://github.com/mafintosh/last-one-wins","gitHead":"a14280ec0c237c20a8be905dfd82b073c99b4bc7","_id":"last-one-wins@1.0.3","_shasum":"d678979048e0ed420340f0b3ae8fc7058db2acbd","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"d678979048e0ed420340f0b3ae8fc7058db2acbd","tarball":"http://registry-npm.ywwl.com/last-one-wins/download/last-one-wins-1.0.3.tgz","integrity":"sha512-yfiROkHA+uqvG6KfhG0ocirLXMJqXCkPWnWDeK8RsB9S/xmvao77NSxjypvIvAaUt039NRkVhA0uWi7xEz9hxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBN9AqHubDCal6cmnWq2sv88DuS4V9A89j4RFYBORuddAiB8a01yzZw9EsB+//HyCOhRgnCFb66+U9iLtSj+Ct7P/w=="}],"size":2541,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.3.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"readme":"# last-one-wins\n\nMake sure the last sync call to an async function is executed after all previous ones have finished\n\n```\nnpm install last-one-wins\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/last-one-wins.svg?style=flat)](http://travis-ci.org/mafintosh/last-one-wins)\n\n## Usage\n\n``` js\nvar low = require('last-one-wins')\n\nvar pick = low(function (num, cb) {\n  setTimeout(function () {\n    console.log('picked', num)\n    cb()\n  }, Math.floor(Math.random() * 100))\n})\n\npick(1)\npick(2)\npick(3)\npick(4)\npick(5) // this one will always win since its called the last\n```\n\nCalling the above will print out\n\n```\npicked 1\npicked 5\n```\n\n## API\n\n#### `var fn = low(asyncWorker)`\n\nWrap a async function to make sure that the last sync call to that\nfunction is executed after any previous calls. Note that not all calls\nare executed - only the last one is guaranteed to be executed.\n\n`fn` and `asyncWorker` should have the signature `(value, cb)`\n\n## Use with leveldb\n\nThis module is useful if you want sync a value to a leveldb and want to\nmake sure the latest version of that value is the one written. For example\n\n``` js\nvar update = low(function (val, cb) {\n  db.put('my-key', val, cb)\n})\n\nupdate('a')\nupdate('b')\nupdate('c')\n```\n\nIs guaranteed to always write `c` to the key `my-key`.\n\n## License\n\nMIT\n","publish_time":1453739732565,"_cnpm_publish_time":1453739732565,"dist-tags":{"latest":"1.0.4"}}