{"id":17398492,"url":"https://github.com/vweevers/thunky-with-args","last_synced_at":"2026-02-18T02:03:20.668Z","repository":{"id":66220592,"uuid":"131401670","full_name":"vweevers/thunky-with-args","owner":"vweevers","description":"Delay the evaluation of a variadic async function and cache the result","archived":false,"fork":false,"pushed_at":"2020-05-25T04:07:37.000Z","size":8,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T04:39:05.916Z","etag":null,"topics":["async","cache","nodejs","npm-package","thunky"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vweevers.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-28T10:54:18.000Z","updated_at":"2019-10-14T09:25:31.000Z","dependencies_parsed_at":"2023-03-17T12:00:38.440Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/thunky-with-args","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.5714285714285714,"last_synced_commit":"cb38e3298e9141f551553c2b946e9543a1be5d9e"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/thunky-with-args","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fthunky-with-args","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fthunky-with-args/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fthunky-with-args/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fthunky-with-args/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/thunky-with-args/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fthunky-with-args/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29566366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T00:47:08.760Z","status":"online","status_checked_at":"2026-02-18T02:00:09.468Z","response_time":162,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cache","nodejs","npm-package","thunky"],"created_at":"2024-10-16T14:57:29.669Z","updated_at":"2026-02-18T02:03:20.652Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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\u0026label=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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fthunky-with-args","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fthunky-with-args","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fthunky-with-args/lists"}