{"id":42415259,"url":"https://github.com/lyonbot/memo-async-fn","last_synced_at":"2026-01-28T01:58:51.867Z","repository":{"id":47892103,"uuid":"244704283","full_name":"lyonbot/memo-async-fn","owner":"lyonbot","description":"combine async / promise calls and cache result in memory with LRU","archived":false,"fork":false,"pushed_at":"2023-03-03T13:54:31.000Z","size":109,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-05T12:32:40.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyonbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-03T17:54:19.000Z","updated_at":"2020-03-08T16:25:51.000Z","dependencies_parsed_at":"2023-02-03T21:46:40.143Z","dependency_job_id":null,"html_url":"https://github.com/lyonbot/memo-async-fn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lyonbot/memo-async-fn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyonbot%2Fmemo-async-fn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyonbot%2Fmemo-async-fn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyonbot%2Fmemo-async-fn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyonbot%2Fmemo-async-fn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyonbot","download_url":"https://codeload.github.com/lyonbot/memo-async-fn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyonbot%2Fmemo-async-fn/sbom","scorecard":{"id":607453,"data":{"date":"2025-08-11","repo":{"name":"github.com/lyonbot/memo-async-fn","commit":"28835f6328b22f28b191707e7f875b77cb343ad5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lyonbot/memo-async-fn/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/lyonbot/memo-async-fn/nodejs.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:21","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"21 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T01:55:29.815Z","repository_id":47892103,"created_at":"2025-08-21T01:55:29.815Z","updated_at":"2025-08-21T01:55:29.815Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28833234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T23:29:49.665Z","status":"ssl_error","status_checked_at":"2026-01-27T23:25:58.379Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-28T01:58:51.817Z","updated_at":"2026-01-28T01:58:51.862Z","avatar_url":"https://github.com/lyonbot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memo-async\n\ncombine async / promise calls and cache result in memory with LRU\n\n[![npm](https://img.shields.io/npm/v/memo-async?style=flat)](https://www.npmjs.com/package/memo-async) [![](https://github.com/lyonbot/memo-async-fn/workflows/Node.js%20CI/badge.svg)](https://github.com/lyonbot/memo-async-fn)\n\n```js\nimport memoAsync from 'memo-async'\n\nconst getUserInfo = memoAsync(   // \u003c- magic\n  async (userId) =\u003e {\n    const { data } = await fetcher('http://xxx/', { userId })\n    return data\n  }\n)\n\n// parallel requests\n\nconst infos = await Promise.all([\n  getUserInfo(12),   // send request\n  getUserInfo(12),   // (cached) re-use 1st request\n  getUserInfo(9),    // send request\n  getUserInfo(12),   // (cached) re-use 1st request\n])\n\n// then request again\n\nconst user5 = await getUserInfo(12)   // get cached result,\n                                      // or send request if last request failed\n\n// after seconds...\n\nconst user6 = await getUserInfo(12)   // send request (cache expired)\n\n```\n\n## API\n\nthis package provides `memoAsync`, which can be a utility function, or a decorator:\n\n- `memoAsync(fn, opts)` returns an wrapped async function, which may combine calls and cache result in memory.\n\n  - **fn** : `Function` - your async function\n  - **opts** : `MemoOptions` - optional, see below\n\n- `memoAsync(opts)` returns a class method decorator\n\n  - **opts** : `MemoOptions` - optional, see below\n\n  Note: each instance has its own LRU cache in memory by default.\n\n  If you have many instances, consider using exact one LRUCache by setting `opts.cache`. Meanwhile, do not forget writing a `opts.genKey`\n\n  **decorator example**\n\n  ```js\n  class Reporter {\n    @memoAsync()\n    async readData(filename) {\n      // some expensive requests\n    }\n  }\n\n  const joe = new Reporter()\n  // now joe.readData() may merge and cache requests\n  ```\n\n### MemoOptions\n\n- **genKey** : `(...args) =\u003e string`\n\n  compute the cache key from arguments.\n\n  *default*: treat args as strings and concat them\n\n  if you are using memoAsync within a class, you may use `this` while computing\n\n- **duration** : `number`\n\n  duration of one batch, aka. how long a result can be cached.\n\n  *default*: 3000 (ms)\n\n- **batchSize** : `number`\n\n  how many requests (invoking) can be merged into one.\n\n  *default*: 500 (# req)\n\n- **cache** : `LRUCache`\n\n  use an existing [lru-cache](https://www.npmjs.com/package/lru-cache) instance.\n\n  if not set, memoAsync will create one.\n\n- **cacheSize** : `number`\n\n  set the cache capacity.\n  works when `cache` is not given.\n\n  *default*: 1000\n\n- **onHit** : `(key, result, args) =\u003e void`  callback when cache is hit.\n\n  - **key** : `string`  the cache key\n\n  - **result** : `Promise`   the cached Promise. you cannot change it\n\n  - **args** : `any[]`   array of arguments\n\n  Note: if you are using memoAsync within a class, `this` will be set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyonbot%2Fmemo-async-fn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyonbot%2Fmemo-async-fn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyonbot%2Fmemo-async-fn/lists"}