{"id":19793562,"url":"https://github.com/darky/rocket-pipes","last_synced_at":"2025-05-01T02:30:43.632Z","repository":{"id":42717259,"uuid":"271886787","full_name":"darky/rocket-pipes","owner":"darky","description":"Powerful pipes for TypeScript, that chain Promise and ADT for you 🚌   -\u003e  ⛰️   -\u003e  🚠   -\u003e  🏂  -\u003e 🚀","archived":false,"fork":false,"pushed_at":"2024-06-16T14:22:27.000Z","size":1139,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T21:52:20.463Z","etag":null,"topics":["adt","aop","chain-promise","compose","composition","context","either","exit","fp-libraries","kleisli","maybe","mock","monet","pipe","pipeline","promise","ramda","ts","typescript","validation"],"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/darky.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":"2020-06-12T20:43:05.000Z","updated_at":"2024-07-25T14:03:02.000Z","dependencies_parsed_at":"2024-01-02T23:42:31.799Z","dependency_job_id":"89d92855-2ec1-4d30-8272-e87bbc020329","html_url":"https://github.com/darky/rocket-pipes","commit_stats":{"total_commits":116,"total_committers":2,"mean_commits":58.0,"dds":0.0431034482758621,"last_synced_commit":"4326cb6ecea3bd14e380b6b3e87fdad7bea4df83"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Frocket-pipes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Frocket-pipes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Frocket-pipes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darky%2Frocket-pipes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darky","download_url":"https://codeload.github.com/darky/rocket-pipes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812264,"owners_count":21647875,"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":["adt","aop","chain-promise","compose","composition","context","either","exit","fp-libraries","kleisli","maybe","mock","monet","pipe","pipeline","promise","ramda","ts","typescript","validation"],"created_at":"2024-11-12T07:10:20.773Z","updated_at":"2025-05-01T02:30:43.289Z","avatar_url":"https://github.com/darky.png","language":"TypeScript","readme":"# Rocket pipes\n\nPowerful pipes for TypeScript, that chain Promise and ADT like Maybe or Either from popular FP libraries.\n\n### Features\n\n- 🍬 Sugar pipes. No worries about promises or ADT itself. Work with resolved values directly.\n- 💡 Type inference. No worries about manual typing work. Types of resolved values inferred automatically.\n- ⛓️ FP libraries friendly. Understand Catamorphism/Foldable libraries.\n- 🖇️ Mix of Promise with FP library. Yes! Catamorphism/Foldable can be included in Promise.\n- 📉 Context. Easy pass context through all pipes.\n- 🚪 Pipeline exit (even nested exit). You can exit from any place of pipeline with result value (it's also have proper type inference 🤘)\n- 🏹 Pipeline replace. You can replace function on pipeline to another on the fly. Useful for mock testing.\n- ➰ AOP. Use beforeAll/afterAll hooks for your pipelines.\n- 🦥 Lazy. Pipeline returns function, that can be used later. It's friendly with Ramda or Sanctuary.\n\n### Library support\n\n| Vanilla | Monet                 | Purify                 | fp-ts             | RxJS / IxJS |\n|---------|-----------------------|------------------------|-------------------|-------------|\n| Promise | Either                | Either                 | Either            | pipe        |\n|         | Maybe                 | Maybe                  | Promise\\\u003cEither\\\u003e |             |\n|         | Validation            | EitherAsync            |                   |             |\n|         | Promise\\\u003cEither\\\u003e     | MaybeAsync             |                   |             |\n|         | Promise\\\u003cMaybe\\\u003e      | Promise\\\u003cEither\\\u003e      |                   |             |\n|         | Promise\\\u003cValidation\\\u003e | Promise\\\u003cMaybe\\\u003e       |                   |             |\n|         |                       | Promise\\\u003cEitherAsync\\\u003e |                   |             |\n|         |                       | Promise\\\u003cMaybeAsync\\\u003e  |                   |             |\n\n*if you want slim version without libraries support, install slim version `npm install rocket-pipes-slim`*\n\n### Examples\n\n##### Basic\n\n```ts\nconst resp = await p(\n  () =\u003e 123,\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Context (❗ mutable)\n\n```ts\nconst resp = await p(\n  () =\u003e 123,\n  pc((ctx: {n: number}) =\u003e n =\u003e n + ctx.n),\n  n =\u003e n + 1\n).context({n: 1})();\nexpect(resp + 1).toEqual(126);\n```\n\n##### Exit pipeline\n\n```ts\nconst resp = await p(\n  () =\u003e 123,\n  (n) =\u003e ep(n + 1),\n  (n) =\u003e \"qwe\"\n)();\niep(resp) \u0026\u0026 expect(resp.r + 1).toEqual(125);\n```\n\n##### Replace pipeline (❗ mutable)\n\n```ts\nconst fn = p(\n  () =\u003e 123,\n  (n) =\u003e n + 1\n);\nconst resp = await fn.replace([[0, () =\u003e 124]])();\nexpect(resp + 1).toEqual(126);\n\nfn.replaceUndo();\nexpect(await fn()).toEqual(125);\n```\n\n##### AOP beforeAll/afterAll hooks\n\n```ts\nbeforeAll((label, n) =\u003e {\n  expect(label).toEqual(\"(n) =\u003e n + 1\\n(n) =\u003e n + 1\");\n  expect(n).toEqual(123);\n});\nafterAll((label, n) =\u003e {\n  expect(label).toEqual(\"(n) =\u003e n + 1\\n(n) =\u003e n + 1\");\n  expect(n).toEqual(125);\n});\np(\n  (n: number) =\u003e n + 1,\n  (n) =\u003e n + 1\n)(123);\n```\n\n##### AOP clear hooks\n\n```ts\nclearAfterAll();\nclearBeforeAll();\n```\n\n##### Promise basic\n\n```ts\nconst resp = await p(\n  () =\u003e Promise.resolve(123),\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Either right\n\n```ts\nconst resp = await p(\n  () =\u003e Either.right(123),\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Promise can include anything supported\n\n```ts\nconst resp = await p(\n  () =\u003e Promise.resolve(Either.right(123)),\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Either left\n\n```ts\nconst resp = await p(\n  () =\u003e Either.left(123),\n  (_, l) =\u003e l + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Maybe some\n\n```ts\nconst resp = await p(\n  () =\u003e Maybe.some(123),\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Maybe none\n\n```ts\nconst resp = await p(\n  () =\u003e Maybe.none(),\n  (s, n) =\u003e s || n\n)();\nexpect(resp).toEqual(void 0);\n```\n\n##### Validation success\n\n```ts\nconst resp = await p(\n  () =\u003e Validation.success(123),\n  (n) =\u003e n + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n\n##### Validation fail\n\n```ts\nconst resp = await p(\n  () =\u003e Validation.fail(123),\n  (_, l) =\u003e l + 1\n)();\nexpect(resp + 1).toEqual(125);\n```\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarky%2Frocket-pipes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarky%2Frocket-pipes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarky%2Frocket-pipes/lists"}