{"id":16252972,"url":"https://github.com/neki-dev/promise-partial","last_synced_at":"2025-04-06T11:13:31.839Z","repository":{"id":57688243,"uuid":"336593674","full_name":"neki-dev/promise-partial","owner":"neki-dev","description":"🧩 Partial (mixed) promise execution","archived":false,"fork":false,"pushed_at":"2024-08-04T22:55:47.000Z","size":263,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T20:37:18.939Z","etag":null,"topics":["async","partial","promise"],"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/neki-dev.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":"2021-02-06T17:21:04.000Z","updated_at":"2024-08-25T22:34:33.000Z","dependencies_parsed_at":"2024-10-27T21:32:02.413Z","dependency_job_id":"b5c3a35f-8c0a-4f21-b1b1-00598e3ba7c8","html_url":"https://github.com/neki-dev/promise-partial","commit_stats":{"total_commits":34,"total_committers":4,"mean_commits":8.5,"dds":0.5294117647058824,"last_synced_commit":"3e9e74af8ac16e7eb350175e2521b2d89278d4f4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neki-dev%2Fpromise-partial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neki-dev%2Fpromise-partial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neki-dev%2Fpromise-partial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neki-dev%2Fpromise-partial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neki-dev","download_url":"https://codeload.github.com/neki-dev/promise-partial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471524,"owners_count":20944158,"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","partial","promise"],"created_at":"2024-10-10T15:15:32.522Z","updated_at":"2025-04-06T11:13:31.770Z","avatar_url":"https://github.com/neki-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ⚡ Promise partial\n[![Version](https://badgen.net/npm/v/promise-partial)](https://npmjs.com/package/promise-partial)\n[![Size](https://img.badgesize.io/neki-dev/promise-partial/master/dist/index.js)](https://github.com/neki-dev/promise-partial/blob/master/dist/index.js)\n[![Build](https://github.com/neki-dev/promise-partial/actions/workflows/build.yml/badge.svg)](https://github.com/neki-dev/promise-partial/actions/workflows/build.yml)\n\nPartial (mixed) promise execution\n\n.\n\n![Partial](https://i.ibb.co/J2ZcvzV/partial.png)\n\nArray is divided on groups by _K_ items. Items in groups is handled in parallel. But groups are called in turn.\n```ts\nawait promisePartial(items, someAsyncFunction, K)\n```\n.\n\nFor example - Default methods:\n\n.\n\n![Serial](https://i.ibb.co/n77YP3n/serial.png)\n\nEach item of array is handled one by one. Like a simple `for`\n```ts\nfor (const value of items) {\n    await someAsyncFunction(value)\n}\n```\n\n.\n\n![Parallel](https://i.ibb.co/hM5RTC5/parallel.png)\n\nEach item of array is handled in parallel. Like a `Promise.all`\n```ts\nawait Promise.all(items.map(someAsyncFunction))\n```\n\n.\n\n* ### Install\n\n```sh\nnpm i promise-partial\n```\n\n* ### Usage\n\n```ts\npromisePartial\u003cT, D\u003e(\n    // Array of items for map\n    array: T[],\n    // Callback for handle of item\n    callback: (item: T, index: number) =\u003e Promise\u003cD\u003e,\n    // Part size for array dividing\n    partSize: number\n): Promise\u003cD\u003e[]:\n```\n\n* ### Example\n\n```ts\nimport promisePartial from 'promise-partial';\n\nconst items = [1, 2, 3, /* and more items */];\nconst partSize = 2;\n\nconst result = await promisePartial(items, async (value) =\u003e {\n    return new Promise((resolve) =\u003e {\n        // some async process\n        setTimeout(() =\u003e resolve(value * 2), 100);\n    });\n}, partSize);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneki-dev%2Fpromise-partial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneki-dev%2Fpromise-partial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneki-dev%2Fpromise-partial/lists"}