{"_id":"last-one-wins","_rev":"237278","name":"last-one-wins","description":"Make sure the last sync call to an async function is executed after all previous ones have finished","dist-tags":{"latest":"1.0.4"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2023-03-24T16:34:16.000Z","created":"2015-11-28T04:43:49.897Z","1.0.4":"2016-01-30T00:03:41.889Z","1.0.3":"2016-01-25T16:35:32.565Z","1.0.2":"2016-01-13T23:55:15.965Z","1.0.1":"2016-01-13T23:30:58.757Z","1.0.0":"2015-11-28T04:43:49.897Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"https://github.com/mafintosh/last-one-wins.git"},"versions":{"1.0.4":{"name":"last-one-wins","version":"1.0.4","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":"84189d018e77044b06b565d9a78d67eebc035aff","_id":"last-one-wins@1.0.4","_shasum":"c1bfd0cbcb46790ec9156b8d1aee8fcb86cda22a","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"c1bfd0cbcb46790ec9156b8d1aee8fcb86cda22a","size":2578,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.4.tgz","tarball":"http://name.csiicloud.com:7001/last-one-wins/download/last-one-wins-1.0.4.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1454112221889,"_hasShrinkwrap":false,"_cnpm_publish_time":1454112221889,"_cnpmcore_publish_time":"2021-12-17T00:25:21.047Z"},"1.0.3":{"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","size":2541,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.3.tgz","tarball":"http://name.csiicloud.com:7001/last-one-wins/download/last-one-wins-1.0.3.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1453739732565,"_hasShrinkwrap":false,"_cnpm_publish_time":1453739732565,"_cnpmcore_publish_time":"2021-12-17T00:25:21.314Z"},"1.0.2":{"name":"last-one-wins","version":"1.0.2","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":"7738338b5146df6f709c8495f93391d66d8af997","_id":"last-one-wins@1.0.2","_shasum":"e8d5117db6e072cb919112e648d2cf843454780c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"e8d5117db6e072cb919112e648d2cf843454780c","size":2529,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.2.tgz","tarball":"http://name.csiicloud.com:7001/last-one-wins/download/last-one-wins-1.0.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1452729315965,"_hasShrinkwrap":false,"_cnpm_publish_time":1452729315965,"_cnpmcore_publish_time":"2021-12-17T00:25:21.483Z"},"1.0.1":{"name":"last-one-wins","version":"1.0.1","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":"f162f176fa260fed45741e01e3c8772f8653e3d5","_id":"last-one-wins@1.0.1","_shasum":"89bf510d0b2777e4076ba8f13e7fd6c718235b49","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"89bf510d0b2777e4076ba8f13e7fd6c718235b49","size":2530,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/last-one-wins/download/last-one-wins-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1452727858757,"_hasShrinkwrap":false,"_cnpm_publish_time":1452727858757,"_cnpmcore_publish_time":"2021-12-17T00:25:21.684Z"},"1.0.0":{"name":"last-one-wins","version":"1.0.0","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":"fa71adc952ffcd21a0851ce2355f709ecf45c34c","_id":"last-one-wins@1.0.0","_shasum":"681287cd1d7c48f45d9f2c3644d2d4fec8c3a1e5","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"681287cd1d7c48f45d9f2c3644d2d4fec8c3a1e5","size":2502,"noattachment":false,"key":"/last-one-wins/-/last-one-wins-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/last-one-wins/download/last-one-wins-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1448685829897,"_hasShrinkwrap":false,"_cnpm_publish_time":1448685829897,"_cnpmcore_publish_time":"2021-12-17T00:25:21.887Z"}},"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","_attachments":{},"homepage":"https://github.com/mafintosh/last-one-wins","bugs":{"url":"https://github.com/mafintosh/last-one-wins/issues"},"license":"MIT"}