{"id":22477099,"url":"https://github.com/schamane/serialexec","last_synced_at":"2025-03-27T17:44:05.394Z","repository":{"id":57678524,"uuid":"491074861","full_name":"schamane/serialExec","owner":"schamane","description":"Serial execution of asynchronouse functions for javascript","archived":false,"fork":false,"pushed_at":"2022-06-21T10:12:19.000Z","size":982,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T11:12:12.951Z","etag":null,"topics":["async","execution","helper","library","nodejs","npm","npm-package","serial","typescript","utility"],"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/schamane.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":"SECURITY.md","support":null}},"created_at":"2022-05-11T11:09:01.000Z","updated_at":"2022-05-12T09:03:01.000Z","dependencies_parsed_at":"2022-09-14T03:23:02.045Z","dependency_job_id":null,"html_url":"https://github.com/schamane/serialExec","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schamane%2FserialExec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schamane%2FserialExec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schamane%2FserialExec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schamane%2FserialExec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schamane","download_url":"https://codeload.github.com/schamane/serialExec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245897299,"owners_count":20690455,"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","execution","helper","library","nodejs","npm","npm-package","serial","typescript","utility"],"created_at":"2024-12-06T14:09:30.482Z","updated_at":"2025-03-27T17:44:05.369Z","avatar_url":"https://github.com/schamane.png","language":"TypeScript","readme":"# serialExec\n\n[![CI][ci-image]][ci-url]\n[![npm version][npm-image]][npm-url]\n[![install size][install-size-image]][install-size-url]\n[![downloads][download-badge]][npm-url]\n\n\u003e Serial execution of asynchronouse functions for javascript with zero dependancies.\n\nUse this if serial execution of anychronouse code should be implemented.\n\nLet say you will execute HTTP request with different values not in parallel, but waiting on request is done, and also be abble to break execution.\n\nPackage can be used als commonjs or esm module\n\n## Breaking API changes for v2\n\n\u003e Note\n\nWe made api changes to package since v1.0, please use \"single\" tag on npm to use older version\n\n```bash\nnpm install @schamane/serial-exec:single\n```\n\n## Usage\n\nThere are two methods that can be used to serial execution of promises\n\n- all\n- overParams\n\n```typescript\n  async all(list: wrapedFunction[]): Promise\u003cT[]\u003e;\n```\n\n```typescript\n  async overParams(params: any[], fn: Function): Promise\u003cT[]\u003e;\n```\n\n### Usage example for all\n\n```javascript\nimport { all, useSerialExec } from '@schamane/serial-exec';\n\nconst delay = async (ms) =\u003e new Promise((resolve) =\u003e setTimeout(resolve, ms));\n\nconst asyncFn = useSerialExec(async (breakFn, ms) =\u003e {\n  if (ms \u003e 300) {\n    return breakFn();\n  }\n  console.log(`fn ${ms} start`);\n  await delay(ms);\n  console.log(`fn ${ms} done`);\n  return ms + 1;\n});\n\nawait all([asyncFn(100), asyncFn(200), asyncFn(400), asyncFn(1000)]);\n```\n\n### Usage example for overParams\n\n```javascript\nimport { overParams } from '@schamane/serial-exec';\n\nconst delay = async (ms) =\u003e new Promise((resolve) =\u003e setTimeout(resolve, ms));\n\nconst asyncFn = async (ms, breakFn) =\u003e {\n  if (ms \u003e 300) {\n    return breakFn();\n  }\n  console.log(`fn ${ms} start`);\n  await delay(ms);\n  console.log(`fn ${ms} done`);\n  return ms + 1;\n};\n\nawait overParams([100, 200, 400, 1000], asyncFn);\n```\n\n## License\n\n[MIT](LICENSE.md)\n\n[npm-url]: https://npmjs.org/package/@schamane/serial-exec\n[npm-image]: https://img.shields.io/npm/v/@schamane/serial-exec.svg\n[download-badge]: http://img.shields.io/npm/dm/@schamane/serial-exec.svg\n[install-size-image]: https://packagephobia.com/badge?p=%40schamane%2Fserial-exec\n[install-size-url]: https://packagephobia.now.sh/result?p=%40schamane%2Fserial-exec\n[ci-image]: https://github.com/schamane/serialExec/actions/workflows/checkcode.yml/badge.svg?branch=main\n[ci-url]: https://github.com/schamane/serialExec/actions\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschamane%2Fserialexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschamane%2Fserialexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschamane%2Fserialexec/lists"}