{"id":27108243,"url":"https://github.com/deviltea/tiny-pipe","last_synced_at":"2025-04-06T21:52:43.774Z","repository":{"id":210871557,"uuid":"727017608","full_name":"DevilTea/tiny-pipe","owner":"DevilTea","description":"A pipe function builder with tiny size and type-safe.","archived":false,"fork":false,"pushed_at":"2023-12-08T02:52:59.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-29T16:03:10.258Z","etag":null,"topics":["functional-programming","pipe","type-safe","typescript"],"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/DevilTea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2023-12-04T02:22:15.000Z","updated_at":"2023-12-08T00:48:43.000Z","dependencies_parsed_at":"2023-12-28T00:29:57.024Z","dependency_job_id":null,"html_url":"https://github.com/DevilTea/tiny-pipe","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.08333333333333337,"last_synced_commit":"22c7c202a0749f3725bff9e70df825059a1effa0"},"previous_names":["deviltea/tiny-pipe"],"tags_count":3,"template":false,"template_full_name":"DevilTea/starter-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevilTea%2Ftiny-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevilTea%2Ftiny-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevilTea%2Ftiny-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevilTea%2Ftiny-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevilTea","download_url":"https://codeload.github.com/DevilTea/tiny-pipe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557760,"owners_count":20958047,"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":["functional-programming","pipe","type-safe","typescript"],"created_at":"2025-04-06T21:52:43.271Z","updated_at":"2025-04-06T21:52:43.765Z","avatar_url":"https://github.com/DevilTea.png","language":"TypeScript","readme":"# @deviltea/tiny-pipe\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![License][license-src]][license-href]\n\nA pipe function builder with tiny size and type-safe.\n\n## Overview\n\n**Tiny Pipe** is a lightweight, type-safe pipe function builder. It allows you to create a sequence of operations, either synchronously or asynchronously, with safe error handling capabilities.\n\n- **Lightweight**: Built with performance and minimal footprint in mind.\n- **Type-safe**: Ensures correct types throughout the pipe's execution.\n- **Error handling**: Built-in mechanisms for safely managing errors during pipeline execution.\n\n## Features\n\n- **Sync and Async Pipelines**: Support both synchronous and asynchronous function chains.\n- **Safe Execution**: Use `pipeSafely` to automatically handle errors within the pipeline.\n- **Tiny Size**: Optimized for minimal overhead while providing robust functionality.\n\n## Installation\n\nInstall the package using `pnpm`:\n\n```bash\npnpm add @deviltea/tiny-pipe\n```\n\nOr with `npm`:\n\n```bash\nnpm install @deviltea/tiny-pipe\n```\n\n## Usage\n\n### Synchronous Pipeline\n\n```ts\nimport { createPipe } from '@deviltea/tiny-pipe'\n\nconst result = createPipe()\n\t.pipe((value: number) =\u003e value + 1)\n\t.pipe((value: number) =\u003e value * 2)\n\t.execute(5)\n\nconsole.log(result) // Output: 12\n```\n\n### Asynchronous Pipeline\n\n```ts\nimport { createPipe } from '@deviltea/tiny-pipe'\n\nconst result = await createPipe()\n\t.pipe(async (value: number) =\u003e value + 1)\n\t.pipe(async (value: number) =\u003e value * 2)\n\t.execute(5)\n\nconsole.log(result) // Output: 12\n```\n\n### Error Handling\n\n```ts\nimport { createPipe } from '@deviltea/tiny-pipe'\n\ncreatePipe()\n\t.pipeSafely(() =\u003e {\n\t\tthrow new Error('Oops!')\n\t})\n\t.pipe((result) =\u003e {\n\t\tif (result.status === 'error') {\n\t\t\tconsole.error(result.reason)\n\t\t}\n\t\telse {\n\t\t\tconsole.log(result.value)\n\t\t}\n\t})\n\t.execute()\n```\n\n## Development\n\n### Scripts\n- `pnpm build`: Build the library.\n- `pnpm dev`: Start development mode.\n- `pnpm lint`: Lint the code.\n- `pnpm test`: Run the test suite with Vitest.\n\n## Contributing\n\nFeel free to open an issue or submit a pull request if you find any bugs or have suggestions for improvements.\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [DevilTea](https://github.com/DevilTea)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/@deviltea/tiny-pipe?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-version-href]: https://npmjs.com/package/@deviltea/tiny-pipe\n[npm-downloads-src]: https://img.shields.io/npm/dm/@deviltea/tiny-pipe?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-downloads-href]: https://npmjs.com/package/@deviltea/tiny-pipe\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/@deviltea/tiny-pipe?style=flat\u0026colorA=080f12\u0026colorB=1fa669\u0026label=minzip\n[bundle-href]: https://bundlephobia.com/result?p=@deviltea/tiny-pipe\n[license-src]: https://img.shields.io/github/license/DevilTea/tiny-pipe.svg?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[license-href]: https://github.com/DevilTea/tiny-pipe/blob/main/LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviltea%2Ftiny-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeviltea%2Ftiny-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviltea%2Ftiny-pipe/lists"}