{"id":43488999,"url":"https://github.com/zacksmash/pipeline.js","last_synced_at":"2026-02-03T09:45:08.876Z","repository":{"id":65421408,"uuid":"592050072","full_name":"zacksmash/pipeline.js","owner":"zacksmash","description":"Laravel's Pipeline in JS form","archived":false,"fork":false,"pushed_at":"2024-07-16T16:12:26.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T11:38:14.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zacksmash.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-22T19:12:39.000Z","updated_at":"2024-05-16T22:47:14.000Z","dependencies_parsed_at":"2024-07-16T19:45:31.848Z","dependency_job_id":"94847a5c-6c9a-4019-87c8-27eba11d721e","html_url":"https://github.com/zacksmash/pipeline.js","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/zacksmash/pipeline.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksmash%2Fpipeline.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksmash%2Fpipeline.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksmash%2Fpipeline.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksmash%2Fpipeline.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacksmash","download_url":"https://codeload.github.com/zacksmash/pipeline.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksmash%2Fpipeline.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29039914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T09:33:44.148Z","status":"ssl_error","status_checked_at":"2026-02-03T09:33:43.343Z","response_time":96,"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":[],"created_at":"2026-02-03T09:45:08.783Z","updated_at":"2026-02-03T09:45:08.867Z","avatar_url":"https://github.com/zacksmash.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pipeline.js\n\nLaravel's Pipeline in JS form\n\n## Installation\n\n```bash\nnpm install @zacksmash/pipeline.js\n```\n\n## Usage\n\nImport the `Pipeline` class and create a new instance of it.\n\n```js\nimport Pipeline from '@zacksmash/pipeline.js'\n\nconst pipeline = new Pipeline()\n\npipeline.send('foo')\n  .through([\n    (value, next) =\u003e next(value + 'bar'),\n    (value, next) =\u003e next(value + 'baz')\n  ])\n  .then((value) =\u003e {\n    console.log(value) // foobarbaz\n  })\n```\n\n## Methods\n\n### send()\n\nThe `send()` method is used to send a value through the pipeline.\n\n```js\nlet value = 'foo'\n\npipeline.send(value)\n```\n\n### through()\n\nThe `through()` method is used to define the pipeline's steps. This can be an anonoymous function or lambda. You may also use a JS Class, with a `handle()` method (this can be overridden with the `via()` method). You may choose to use a static method to handle the value, or an instance method.\n\n```js\n// Lambda, Anonoymous function\nconst pipeTwo = (value, next) =\u003e next(value + 'baz')\n\n// Class\nclass PipeThree {\n  handle(value, next) {\n    return next(value + 'qux')\n  }\n}\n\n// Static method\nclass PipeFour {\n  static handle(value, next) {\n    return next(value + 'quux')\n  }\n}\n\npipeline.send('foo')\n  .through([\n    pipeOne,\n    pipeTwo,\n    new PipeThree,\n    PipeFour\n  ])\n```\n\n### pipe()\n\nThe `pipe()` method is used to define a single step in the pipeline.\n\n```js\npipeline.send('foo')\n  .pipe((value, next) =\u003e next(value + 'bar'))\n  .pipe((value, next) =\u003e next(value + 'baz'))\n  .then((value) =\u003e {\n    console.log(value) // foobarbaz\n  })\n```\n\n### via()\n\nThe `via()` method is used to define the method to call on a class. This is useful if you want to use a class, but don't want to use the `handle()` method. For example, if you want to use a class with a `process()` method:\n\n```js\nclass PipeFive {\n  process(value, next) {\n    return next(value + 'quuz')\n  }\n}\n\npipeline.send('foo')\n  .through([\n    new PipeFive\n  ])\n  .via('process')\n```\n\n### then()\n\nThe `then()` method is used to define the callback to run after the pipeline has finished.\n\n```js\npipeline.send('foo')\n  .through([\n    (value, next) =\u003e next(value + 'bar'),\n    (value, next) =\u003e next(value + 'baz')\n  ])\n  .then((value) =\u003e {\n    console.log(value) // foobarbaz\n  })\n```\n\n### thenReturn()\n\nThe `thenReturn()` method is used to return the value after the pipeline has finished.\n\n```js\nconst result = pipeline.send('foo')\n  .through([\n    (value, next) =\u003e next(value + 'bar'),\n    (value, next) =\u003e next(value + 'baz')\n  ])\n  .thenReturn()\n\nconsole.log(result) // foobarbaz\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksmash%2Fpipeline.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacksmash%2Fpipeline.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksmash%2Fpipeline.js/lists"}