{"id":20605633,"url":"https://github.com/vunovati/memoize-methods","last_synced_at":"2026-01-28T17:36:18.395Z","repository":{"id":36977749,"uuid":"235301397","full_name":"Vunovati/memoize-methods","owner":"Vunovati","description":"Memoize methods of a given JavaScript object","archived":false,"fork":false,"pushed_at":"2023-01-16T04:01:07.000Z","size":443,"stargazers_count":1,"open_issues_count":13,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T08:16:32.680Z","etag":null,"topics":["cache","memoize","memoize-decorator","proxy","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Vunovati.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}},"created_at":"2020-01-21T09:27:29.000Z","updated_at":"2021-09-01T10:08:46.000Z","dependencies_parsed_at":"2023-01-17T10:46:20.426Z","dependency_job_id":null,"html_url":"https://github.com/Vunovati/memoize-methods","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vunovati%2Fmemoize-methods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vunovati%2Fmemoize-methods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vunovati%2Fmemoize-methods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vunovati%2Fmemoize-methods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vunovati","download_url":"https://codeload.github.com/Vunovati/memoize-methods/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248993348,"owners_count":21195178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cache","memoize","memoize-decorator","proxy","typescript"],"created_at":"2024-11-16T09:28:44.045Z","updated_at":"2026-01-28T17:36:18.315Z","avatar_url":"https://github.com/Vunovati.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memoize-methods\n\nMemoize methods of a given JavaScript object\n\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![NPM](https://nodei.co/npm/memoize-methods.png?mini=true)](https://npmjs.org/package/memoize-methods)\n\n## usage\n\nInitialize the memoization store. The store will keep the memoized objects\nfor as long as the originals are not garbage collected (it uses a WeakMap).\n\n```\nconst memoizeMethods = createMemoizeMethods()\n```\n\n```\nconst memoizedUserRepository = memoizeMethods(slowUserDbRepository)\n```\n\nthe first call will be as slow as if we'd called the original user repo\n\n```\nconst user = await memoizedUserRepository.getUser(userId) // slow\n```\n\nthe second call will return the promise from the previous call which prevents\nthe unnecessary repeated async call (e.g. towards a slow db)\n\n```\nconst userFast = await memoizedUserRepository.getUser(userId) // fast\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvunovati%2Fmemoize-methods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvunovati%2Fmemoize-methods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvunovati%2Fmemoize-methods/lists"}