{"id":26246456,"url":"https://github.com/kamdz/incrementator","last_synced_at":"2025-12-25T18:39:26.085Z","repository":{"id":281391368,"uuid":"945145625","full_name":"kamdz/incrementator","owner":"kamdz","description":"🔂  A lightweight TypeScript utility for iterating over multiple numeric parameters with flexible control.","archived":false,"fork":false,"pushed_at":"2025-03-08T19:23:44.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T19:28:52.532Z","etag":null,"topics":["increment","loop","range","step"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/incrementator","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/kamdz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-03-08T19:02:41.000Z","updated_at":"2025-03-08T19:23:47.000Z","dependencies_parsed_at":"2025-03-08T19:38:58.289Z","dependency_job_id":null,"html_url":"https://github.com/kamdz/incrementator","commit_stats":null,"previous_names":["kamdz/incrementator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fincrementator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fincrementator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fincrementator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fincrementator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamdz","download_url":"https://codeload.github.com/kamdz/incrementator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243410413,"owners_count":20286403,"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":["increment","loop","range","step"],"created_at":"2025-03-13T13:18:48.776Z","updated_at":"2025-12-25T18:39:26.045Z","avatar_url":"https://github.com/kamdz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔂 incrementator  \n\nA lightweight TypeScript utility for iterating over multiple numeric parameters with flexible control. \n\nThe `incrementator` utility can be seen as a replacement for traditional nested loops.\nUsing `incrementator` simplifies the iteration process, especially when working with multiple parameters and dynamic step functions.\n\n## 🚀 Features  \n\n- Iterate over multiple parameters simultaneously  \n- Support for dynamic step functions  \n- Flexible stop conditions (fixed or function-based)  \n- Efficient iteration without unnecessary computations  \n\n## 🛠️ Installation  \n\n```sh\nnpm install incrementator\n```\n\n## 📖 Usage\n\n```typescript\nimport incrementator from \"incrementator\";\n\nincrementator(\n  {\n    x: { start: 0, stop: 2, step: 1 },\n    y: { start: 5, stop: 3, step: -0.5 },\n  },\n  ({ x, y }) =\u003e console.log(`x=${x}, y=${y}`)\n);\n// Output:\n// x=0, y=5\n// x=0, y=4.5\n// x=0, y=4\n// x=0, y=3.5\n// x=0, y=3\n// x=1, y=5\n\n// Equivalent code with for loops\n// for (let x = 0; x \u003c 2; x++) {\n//   for (let y = 5; y \u003e= 3; y -= 0.5) {\n//     console.log(`x=${x}, y=${y}`);\n//   }\n// }\n\nincrementator(\n  {\n    a: { start: 1, stop: 10, step: (current) =\u003e current * 2 },\n  },\n  ({ a }) =\u003e console.log(`a=${a}`)\n);\n// Output:\n// a=1\n// a=2\n// a=4\n// a=8\n\n// Equivalent code with while loop\n// let a = 1;\n// while (a \u003c 10) {\n//   console.log(`a=${a}`);\n//   a *= 2;\n// }\n```\n\n## 🔧 API  \n\n### `incrementator(config, callback)`\n\nIterates over multiple numeric parameters, calling `callback` for each combination.  \n\n- `config: Record\u003cstring, IncrementatorConfig\u003e` – Configuration object where each key defines a parameter and its value is an object with the following properties:\n    - `start: number` – Initial value.  \n    - `stop: number | (current: number) =\u003e boolean` – Fixed stop value or a function to determine when to stop.  \n    - `step: number | (current: number) =\u003e number` – Fixed step value or a function to compute the next value.\n- `callback: (values: Record\u003cstring, number\u003e) =\u003e void` – Function executed for each combination of values.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamdz%2Fincrementator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamdz%2Fincrementator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamdz%2Fincrementator/lists"}