{"id":41206783,"url":"https://github.com/pyatyispyatil/sequence-stepper","last_synced_at":"2026-01-22T22:09:54.007Z","repository":{"id":72112801,"uuid":"75883526","full_name":"pyatyispyatil/sequence-stepper","owner":"pyatyispyatil","description":"Asynchronous sequence","archived":false,"fork":false,"pushed_at":"2017-08-08T22:59:14.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-13T10:52:46.184Z","etag":null,"topics":["async","asynchronous","functions","insertafter","insertbefore","sequence","stepper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyatyispyatil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-07T23:13:46.000Z","updated_at":"2020-06-29T18:14:31.000Z","dependencies_parsed_at":"2023-09-26T03:36:34.652Z","dependency_job_id":null,"html_url":"https://github.com/pyatyispyatil/sequence-stepper","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":"0.39473684210526316","last_synced_commit":"cb3cfa029441d372ac51a2c71af84ece451ebd2d"},"previous_names":["gloooom/sequence-stepper"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/pyatyispyatil/sequence-stepper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyatyispyatil%2Fsequence-stepper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyatyispyatil%2Fsequence-stepper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyatyispyatil%2Fsequence-stepper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyatyispyatil%2Fsequence-stepper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyatyispyatil","download_url":"https://codeload.github.com/pyatyispyatil/sequence-stepper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyatyispyatil%2Fsequence-stepper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28672628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["async","asynchronous","functions","insertafter","insertbefore","sequence","stepper"],"created_at":"2026-01-22T22:09:53.233Z","updated_at":"2026-01-22T22:09:53.997Z","avatar_url":"https://github.com/pyatyispyatil.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sequence-stepper\n\nThe small lib for the asynchronous control of queue of functions. It can start an execution at any step in a queue till the end.\n\n## Installation\n\n```console\nnpm install --save sequence-stepper\n```\n\n## Usage\n\n### class Stepper\nCreation a stepper queue\n```js\nimport {Stepper} from 'sequence-stepper';\n\nlet stepper = new Stepper([\n  (step, data, done) =\u003e step.next(++data),\n  (step, data, done) =\u003e data \u003e 2 ? step.next(data * 2) : step.reject('fail'),\n  (step, data, done) =\u003e done ? console.log(data) : null;\n], (message) =\u003e console.log(message));\n```\n\nCallbacks arguments description\n - _step_ - a StepDescription instance. With that you can manipulate an execution.\n - _data_ - returned value of previous step\n - _done_ - flag of last step\n\nStart an execution\n```js\nstepper.start(data);\n```\n\nYou can step back with the same code (backward step doesn't execute)\n```js\nstepper.prev();\n```\n\nExecute a step after stepDescriptor\n```js\nstepper.next(data, stepper.steps[2]);\n```\n\nExecution on some step in queue\n```js\nlet savedStepDescriptor;\n\nlet stepper = new Stepper([\n  (step) =\u003e {...},\n  (step) =\u003e {\n    //some behavior\n    ...\n    savedStepDescriptor = step;\n    step.next();\n  },\n  (step) =\u003e {...}\n]);\n\nstepper.start()//execute queue till the end\n\nsavedStepDescriptor.next()//execute queue from saved step till the end;\n```\n\ninsertBefore and insertAfter usage\n```js\nlet stepper = new Stepper([\n  ...\n  (step) =\u003e {\n    step.insertAfter((step) =\u003e step.next());\n    step.insertBefore((step) =\u003e step.next());\n    step.next();\n  },\n  ...\n]);\n```\nor\n```js\nlet stepper = new Stepper([...]);\nstepper.insertAfter(stepper.getStep(2), ({next}) =\u003e next());\n```\nor\n```js\nlet savedStepDescriptor;\n\nlet stepper = new Stepper([\n  ...\n  (step) =\u003e {\n    savedStepDescriptor = step;\n    step.next();\n  },\n  ...\n]);\n\nsavedStepDescriptor.insertAfter(({next}) =\u003e next());\n```\n\nBrief usage of Stepper\n```js\nlet stepper = new Stepper([\n  ({next}) =\u003e next(),\n  ({next}) =\u003e setTimeout(next, 100),\n  ({next}) =\u003e console.log('complete')\n]);\n\nstepper.start();\n```\n\n### function sequence\nIts help you to make a function thats launches a queue till the end. You can make it with this simple functional conveyors.\n```js\nimport {sequence} from 'sequence-stepper';\n\nlet queue = sequence([\n  (step, data, done) =\u003e step.next(data * 2),\n  (step, data, done) =\u003e step.next(data + 4),\n  (step, data, done) =\u003e data * 3,\n]);\n\nlet result = queue(5);//result === 42\n```\n\nYou can add an asynchronous behavior into a steps\n```js\nlet queue = sequence([\n  (step, data, done) =\u003e setTimeout(() =\u003e step.next(data + 11), 100),\n  (step, data, done) =\u003e console.log(data * 2),\n]);\n\nqueue(10);//output 42 in console after 100ms\n```\n\n\n### Notice\nIn outline Stepper and sequence has a similar behavior. \nIf you don`t want to use insertAfter and insertBefore, you can restrict a sequence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyatyispyatil%2Fsequence-stepper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyatyispyatil%2Fsequence-stepper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyatyispyatil%2Fsequence-stepper/lists"}