{"id":20536313,"url":"https://github.com/spudnyk/async-wrappers","last_synced_at":"2026-04-16T16:04:06.864Z","repository":{"id":40798111,"uuid":"190626905","full_name":"SpudNyk/async-wrappers","owner":"SpudNyk","description":"Various functions for asynchronous operations","archived":false,"fork":false,"pushed_at":"2023-01-06T02:00:29.000Z","size":2317,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-01T03:32:15.019Z","etag":null,"topics":["async","async-functions","debounce","javascript","promise","throttle"],"latest_commit_sha":null,"homepage":"https://spudnyk.github.io/async-wrappers","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/SpudNyk.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":"2019-06-06T18:02:16.000Z","updated_at":"2020-07-17T18:47:26.000Z","dependencies_parsed_at":"2023-02-05T02:16:50.047Z","dependency_job_id":null,"html_url":"https://github.com/SpudNyk/async-wrappers","commit_stats":null,"previous_names":["spudnyk/async-call-limiter"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpudNyk%2Fasync-wrappers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpudNyk%2Fasync-wrappers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpudNyk%2Fasync-wrappers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpudNyk%2Fasync-wrappers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpudNyk","download_url":"https://codeload.github.com/SpudNyk/async-wrappers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242143108,"owners_count":20078843,"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":["async","async-functions","debounce","javascript","promise","throttle"],"created_at":"2024-11-16T00:36:13.758Z","updated_at":"2026-04-16T16:04:06.826Z","avatar_url":"https://github.com/SpudNyk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async-wrappers\n\nImplementations of debounce, throttle, retry and more targeted to promises/async/await.\n\n## Key Features\n\n1. call argument aggregation - all arguments from calls to the wrapper can be combined for the call to the wrapped function, using a supplied argument reducer function. See the api documentation for supplied reducers.\n2. call return values - calls to the wrapper will return a promise to wrapped function's result.\n3. delay times of 0 are still asynchronous and will resolve on the next runtime loop.\n\n## Documentation\n\nSee the [API](https://spudnyk.github.io/async-wrappers/api/).\n\n## Example\n\n```javascript\nconst { debounce, combineArguments } = require('async-wrappers');\nconst data = {\n    1: 'data 1',\n    2: 'data 2'\n    //...\n};\n\n// this could be fetching from a database or webservice\n// debounce supports async functions or returned promises\nconst getByIds = ids =\u003e {\n    console.log(`Getting: ${JSON.stringify(ids)}`);\n    const keyed = {};\n    // this could be a server request\n    for (const id of ids) {\n        keyed[id] = data[id];\n    }\n    return keyed;\n};\n\n// data loader equivalent\nconst load = debounce(getByIds, 0, {\n    reducer: combineArguments\n});\nconst loadData = async id =\u003e {\n    const data = await load(id);\n    return data[id];\n};\n\nconst main = async () =\u003e {\n    const foo = loadData(2);\n    const bar = loadData(1);\n    const baz = loadData(3);\n    console.log(`Foo: ${await foo}`);\n    console.log(`Bar: ${await bar}`);\n    console.log(`Baz: ${await baz}`);\n};\n\nmain();\n\n// Outputs:\n// Getting: [2,1,3]\n// Foo: data 2\n// Bar: data 1\n// Baz: undefined\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspudnyk%2Fasync-wrappers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspudnyk%2Fasync-wrappers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspudnyk%2Fasync-wrappers/lists"}