{"id":15369888,"url":"https://github.com/sergiodxa/swr-mutate-many","last_synced_at":"2025-10-12T06:10:18.917Z","repository":{"id":38361010,"uuid":"245074543","full_name":"sergiodxa/swr-mutate-many","owner":"sergiodxa","description":"Little function to call mutate against multiple cached keys of SWR","archived":false,"fork":false,"pushed_at":"2023-01-25T10:04:52.000Z","size":731,"stargazers_count":27,"open_issues_count":18,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T13:53:52.187Z","etag":null,"topics":["mutate","mutate-many","react","swr","typescript"],"latest_commit_sha":null,"homepage":"","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/sergiodxa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"sergiodxa","github":"sergiodxa","custom":"https://paypal.me/sergiodxa/5"}},"created_at":"2020-03-05T05:11:18.000Z","updated_at":"2024-07-26T02:50:05.000Z","dependencies_parsed_at":"2023-02-14T06:31:38.768Z","dependency_job_id":null,"html_url":"https://github.com/sergiodxa/swr-mutate-many","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sergiodxa/swr-mutate-many","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiodxa%2Fswr-mutate-many","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiodxa%2Fswr-mutate-many/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiodxa%2Fswr-mutate-many/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiodxa%2Fswr-mutate-many/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergiodxa","download_url":"https://codeload.github.com/sergiodxa/swr-mutate-many/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiodxa%2Fswr-mutate-many/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010478,"owners_count":26084757,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["mutate","mutate-many","react","swr","typescript"],"created_at":"2024-10-01T13:39:07.308Z","updated_at":"2025-10-12T06:10:18.884Z","avatar_url":"https://github.com/sergiodxa.png","language":"TypeScript","funding_links":["https://patreon.com/sergiodxa","https://github.com/sponsors/sergiodxa","https://paypal.me/sergiodxa/5"],"categories":[],"sub_categories":[],"readme":"# SWR Mutate Many\n\n![CI](https://github.com/sergiodxa/swr-mutate-many/workflows/CI/badge.svg)\n![Publish](https://github.com/sergiodxa/swr-mutate-many/workflows/Publish/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ca0f1ecf8819788f7811/maintainability)](https://codeclimate.com/github/sergiodxa/swr-mutate-many/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ca0f1ecf8819788f7811/test_coverage)](https://codeclimate.com/github/sergiodxa/swr-mutate-many/test_coverage)\n\nLittle function to call mutate against multiple cached keys of SWR.\n\n## Usage\n\nInstall it\n\n```sh\n$ yarn add swr swr-mutate-many\n```\n\nImport it and use it\n\n```ts\nimport { mutateMany } from 'swr-mutate-many';\n\nmutateMany('key-*', 'New Value', false);\n```\n\nNow mutateMany will change the value of any key matching the glob `key-*` (any starting with `key-`) to have the value `\"New Value\"` and it won't trigger a revalidation.\n\n## API\n\nmutateMany follow a similar API as SWR mutate.\n\n1. The key to mutate, in our case it could be:\n\n- A string supporting globs to match the key, useful for simple logic\n- A function which will receive the key and should return true/false if it matches, useful for complex logic\n\n2. The new value to use, a promise whose resolved value will be used or a function receiving the current value\n3. If the keys should be revalidated, in our case it could be:\n\n- A boolean, as in mutate, useful if you want all to revalidate or not\n- A function, which will receive the key and return a boolean, useful for complext logic\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergiodxa%2Fswr-mutate-many","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergiodxa%2Fswr-mutate-many","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergiodxa%2Fswr-mutate-many/lists"}