{"id":24482558,"url":"https://github.com/twilkinson3421/flec-pipe","last_synced_at":"2026-02-11T01:32:22.227Z","repository":{"id":253447378,"uuid":"843534819","full_name":"twilkinson3421/flec-pipe","owner":"twilkinson3421","description":"Brings support for piping to JavaScript, with full TypeScript integration","archived":false,"fork":false,"pushed_at":"2024-08-17T12:30:54.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T21:25:51.306Z","etag":null,"topics":["functional-programming","types","typescript","typescript-library","utility"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/flec-pipe","language":"TypeScript","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/twilkinson3421.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,"zenodo":null}},"created_at":"2024-08-16T18:19:26.000Z","updated_at":"2024-08-17T12:30:57.000Z","dependencies_parsed_at":"2024-08-16T19:43:06.240Z","dependency_job_id":"b87d7901-9431-481c-81e1-3cf6b7356677","html_url":"https://github.com/twilkinson3421/flec-pipe","commit_stats":null,"previous_names":["twilkinson3421/flec-pipe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twilkinson3421/flec-pipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilkinson3421%2Fflec-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilkinson3421%2Fflec-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilkinson3421%2Fflec-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilkinson3421%2Fflec-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twilkinson3421","download_url":"https://codeload.github.com/twilkinson3421/flec-pipe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilkinson3421%2Fflec-pipe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29324200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T00:34:26.354Z","status":"ssl_error","status_checked_at":"2026-02-11T00:34:09.494Z","response_time":65,"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":["functional-programming","types","typescript","typescript-library","utility"],"created_at":"2025-01-21T12:14:21.426Z","updated_at":"2026-02-11T01:32:22.214Z","avatar_url":"https://github.com/twilkinson3421.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flec Pipe\n\nBrings support for piping to JavaScript, with full TypeScript integration. Use it to write clean, readable, and maintainable JavaScript.\n\nFlec Pipe uses [tartak](https://npmjs.com/package/tartak) under the hood, to help keep this library understandable and maintainable. Look at this library's [source code](https://github.com/twilkinson3421/flec-pipe) to see how it works.\n\n## Installation\n\n```bash\nnpm install flec-pipe\n```\n\n```bash\npnpm add flec-pipe\n```\n\n```bash\nyarn add flec-pipe\n```\n\n## Usage\n\nFlec Pipe is easy to get started with, and works just like in other languages with built-in support for piping.\n\nTo use pipes in your code, import the `pipe` function from `flec-pipe`.\n\n```ts\nimport { pipe } from \"flec-pipe\";\n\nconst result = pipe(-16, Math.abs, Math.sqrt);\n// result = 4\n```\n\nThe `pipe` function supports **up to 40 functions** (_in addition to the initial value - thus 41 arguments in total_).\n\n## Pipize\n\nFlec Pipe also provides a function called `pipize`. This function allows you to mutate an exisiting function, with parameters, to make it suitable for piping. You can also specify the index of the parameter which the piped value should fill. Here's an example of how to use it.\n\n```ts\nimport { pipe, pipize } from \"flec-pipe\";\n\nconst divide = (a: number, b: number) =\u003e a / b;\n\n// prettier-ignore\nconst result = pipe(\n  -16,\n  Math.abs,\n  pipize([divide, 0], 2)\n);\n\n// result = 16 / 2\n// = 8\n\n// prettier-ignore\nconst result2 = pipe(\n  -16,\n  Math.abs,\n  pipize([divide, 1], 2)\n);\n\n// result2 = 2 / 16\n// = 0.125\n```\n\nNotice the difference between the two results. The first argument of `pipize` is an array containing the function to be made pipable, and the index of the parameter which the piped value should fill.\n\nIn the first example, the piped value takes the place of the first parameter (see the `0` in the array). This causes the piped value, in this case `16`, to be passed as the first parameter to the `divide` function.\n\nIn the second example, the piped value takes the place of the second parameter (see the `1` in the array). This causes the piped value to be passed as the second parameter to the `divide` function.\n\nThe following arguments of the `pipize` function represent the other parameters of the function to be made pipable, in order (excluding the parameter which the piped value should fill), and fully typed.\n\nThis can be useful for piping values to JavaScript functions which take multiple parameters. For example:\n\n```ts\nimport { pipe, pipize } from \"flec-pipe\";\n\n// prettier-ignore\nconst result = pipe(\n  -16,\n  Math.abs,\n  Math.sqrt,\n  pipize([Math.pow, 0], 3)\n);\n\n// trace:\n// -16\n// Math.abs -\u003e 16\n// Math.sqrt -\u003e 4\n// Math.pow(4, 3) -\u003e 64\n```\n\nIf we wanted to raise a given value, such as `3`, to the power equal to the piped value, we can simply modify the `pipize` function call to say that the piped value should fill the second parameter of `Math.pow`.\n\n```ts\nimport { pipe, pipize } from \"flec-pipe\";\n\n// prettier-ignore\nconst result = pipe(\n  -16,\n  Math.abs,\n  Math.sqrt,\n  pipize([Math.pow, 1], 3)\n);\n\n// result = 3 ** 4\n// = 81\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilkinson3421%2Fflec-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilkinson3421%2Fflec-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilkinson3421%2Fflec-pipe/lists"}