{"_id":"thunky-with-args","_rev":"2-ccd7e76f98d6a5a913f0e475a9c8a2d8","name":"thunky-with-args","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"thunky-with-args","version":"1.0.0","description":"Delay the evaluation of a variadic async function and cache the result","license":"MIT","author":{"name":"Vincent Weevers"},"scripts":{"test":"standard && node test"},"dependencies":{"sigmund":"~1.0.1","thunky":"~1.0.2"},"devDependencies":{"run-parallel":"~1.1.9","standard":"~11.0.1","tape":"~4.9.0"},"keywords":["async","cache","mem","memoize","thunk","thunky"],"engines":{"node":">=6.4.0"},"repository":{"type":"git","url":"git+https://github.com/vweevers/thunky-with-args.git"},"bugs":{"url":"https://github.com/vweevers/thunky-with-args/issues"},"homepage":"https://github.com/vweevers/thunky-with-args","gitHead":"7597f92c8dae51bc376e0107f47baf7c8fa02b86","_id":"thunky-with-args@1.0.0","_shasum":"5b202235d8e6c88986c941226c0b4d7e49b2e25d","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.0","_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"dist":{"shasum":"5b202235d8e6c88986c941226c0b4d7e49b2e25d","tarball":"https://registry.npmjs.org/thunky-with-args/-/thunky-with-args-1.0.0.tgz","fileCount":7,"unpackedSize":7284,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa5G69CRA9TVsSAnZWagAA+kQP/AxGFoZlznoAun5GRksR\nJItc/jmalCihtKXSvTvf85VgGK7qFWw2BM8sVaY1TLgPwUFzyXLCFNOvPhWB\ngemqqeKQILoGWwQindBVGO3+Zt+KiLir36qKkeFgHRZmhI247zXT4vNUb5sA\n1y1fvzjyDEjDQl/lG8gzV8nL+zXQkdQPe9y5h+GwI8d3ynFRlnj4FYF6m2KI\nICoLIcq5H3ZZMfspKPNcgcM4Y/psq1FyNq2kGGQOQ3ZeN34L0gCdscC30K9g\nZCxISYiiOcwFkt++vv115vUIeLxUIb0tYrR5JnypXUgKo2UeXiyJ9b4Wv8dA\nSygGV/hghDkjAlfOWy4A5qSGWtOn9RAHWRVAq7S/eMStu/HUo3hsCVjrcI/Z\nMsEhPSQL2OS3F/kPC06d9gMvOfbg0c9bfTPAgLmdPCix7a9omv5c6y8AMWg7\n7V66Uj76VIw9rwHDymC+s81IBD+PPQe13EeLyB7SGw6BtYITayjmzgd0gwpt\nG0fc65M63uQclAgyzk1uoSzWKzxNQ8ZSTrEm4g+zcNWU5O5J2tZizgFEEgDr\nz3/Lln4u+sKSwXLkN1n7eVzUIZdgcjfePssb4r9P3RyJ1BOHhN63ZMu18XW/\nIYWH13NC7UERyJSzUp2QDFs0CW3v/z+BqyIpVfOw/w1uY8ZnhFxmiAbaPTqX\nLkPe\r\n=wTPB\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-e9QU3bJpxzJx1XcQ1ivwW15xoR3oUJ8MTSpboSTVcTAii2KoxrUaEo+x3PxkgseflqjynJsUP3IqB9jwDZwNtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICq0Myx5ZmArJtnaZg7ggz3U1nb2EL0YNnvS/U4WVVkMAiA6WiVawkGyyTiwVb5Op3zId6gyaPXQF8XxT8n/XvH8Tg=="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/thunky-with-args_1.0.0_1524919996130_0.8406197204837544"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-28T12:53:16.130Z","1.0.0":"2018-04-28T12:53:16.244Z","modified":"2022-06-27T06:28:28.977Z"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"description":"Delay the evaluation of a variadic async function and cache the result","homepage":"https://github.com/vweevers/thunky-with-args","keywords":["async","cache","mem","memoize","thunk","thunky"],"repository":{"type":"git","url":"git+https://github.com/vweevers/thunky-with-args.git"},"author":{"name":"Vincent Weevers"},"bugs":{"url":"https://github.com/vweevers/thunky-with-args/issues"},"license":"MIT","readme":"# thunky-with-args\n\nLike [thunky](https://github.com/mafintosh/thunky) but:\n\n**Delay the evaluation of a ~~paramless~~ variadic async function and cache the result.**\n\n[![npm status](http://img.shields.io/npm/v/thunky-with-args.svg?style=flat-square)](https://www.npmjs.org/package/thunky-with-args)\n[![node](https://img.shields.io/node/v/thunky-with-args.svg?style=flat-square)](https://www.npmjs.org/package/thunky-with-args)\n[![Travis build status](https://img.shields.io/travis/vweevers/thunky-with-args.svg?style=flat-square&label=travis)](http://travis-ci.org/vweevers/thunky-with-args)\n[![Dependency status](https://img.shields.io/david/vweevers/thunky-with-args.svg?style=flat-square)](https://david-dm.org/vweevers/thunky-with-args)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)\n\n## example\n\n```js\nconst dns = require('dns')\nconst memoize = require('thunky-with-args')\n\nconst lookup = memoize(function (hostname, opts, callback) {\n  if (typeof opts === 'function') {\n    callback = opts\n    opts = null\n  }\n\n  console.log('lookup', hostname, opts)\n  dns.lookup(hostname, opts, callback)\n})\n\nlookup('localhost', console.log)\nlookup('localhost', console.log)\nlookup('localhost', console.log)\nlookup('localhost', { family: 6 }, console.log)\nlookup('localhost', { family: 6 }, console.log)\n```\n\nThis results in two lookups, the other calls are cached:\n\n```\nlookup localhost null\nlookup localhost { family: 6 }\nnull '127.0.0.1' 4\nnull '127.0.0.1' 4\nnull '127.0.0.1' 4\nnull '::1' 6\nnull '::1' 6\n```\n\n## `thunk = thunkyWithArgs(work[, stringify])`\n\nReturns a function `thunk` that caches the result of `work(..)` unless it returned an error. Optionally provide a `stringify` function that converts an array of arguments to a cache key. Defaults to [`sigmund`](https://github.com/isaacs/sigmund) which works well for primitives, arrays and plain objects but takes a few shortcuts to be fast.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install thunky-with-args\n```\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n","readmeFilename":"readme.md"}