{"id":19197920,"url":"https://github.com/flarebyte/fairlie-functional","last_synced_at":"2026-05-18T14:04:18.916Z","repository":{"id":145579637,"uuid":"551302170","full_name":"flarebyte/fairlie-functional","owner":"flarebyte","description":"A lightweight functional library in typescript that helps dealing with failures the rail way","archived":false,"fork":false,"pushed_at":"2023-09-11T04:37:24.000Z","size":450,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-26T09:28:07.287Z","etag":null,"topics":["npm-package","railway-oriented-programming","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/flarebyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2022-10-14T06:44:23.000Z","updated_at":"2023-06-06T19:42:44.000Z","dependencies_parsed_at":"2024-09-18T22:00:31.599Z","dependency_job_id":null,"html_url":"https://github.com/flarebyte/fairlie-functional","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Ffairlie-functional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Ffairlie-functional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Ffairlie-functional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Ffairlie-functional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flarebyte","download_url":"https://codeload.github.com/flarebyte/fairlie-functional/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271540,"owners_count":19774859,"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":["npm-package","railway-oriented-programming","typescript"],"created_at":"2024-11-09T12:19:31.410Z","updated_at":"2026-05-18T14:04:13.874Z","avatar_url":"https://github.com/flarebyte.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fairlie-functional\n\n![npm](https://img.shields.io/npm/v/fairlie-functional) ![Build status](https://github.com/flarebyte/fairlie-functional/actions/workflows/main.yml/badge.svg) ![npm bundle size](https://img.shields.io/bundlephobia/min/fairlie-functional)\n\n![npm type definitions](https://img.shields.io/npm/types/fairlie-functional) ![node-current](https://img.shields.io/node/v/fairlie-functional) ![NPM](https://img.shields.io/npm/l/fairlie-functional)\n\n![Experimental](https://img.shields.io/badge/status-experimental-blue)\n\n\u003e A lightweight functional library in typescript that helps dealing with failures the rail way\n\nA lightweight functional library in typescript that helps dealing with failures the rail way\n\n![Hero image for fairlie-functional](fairlie-functional-hero-512.jpeg)\n\nHighlights:\n\n* A take on Railway Oriented Programming (ROP) in typescript\n* Each function will always yield a failure or a success\n* You can easily combine multiple functions into a single unit using operators\n* Support for promises\n\n\n\nA few examples of commands:\n\nBind two switch functions:\n```typescript\nbindTwo(min3char, valueifyShort)('some text')\n\n```\nBind three switch functions:\n```typescript\nbindThree(min3char, max20char, valueifyShort)('some text')\n\n```\nBind three similar switch functions:\n```typescript\nbindSimilar([min3char, max20char, notDot])('some text')\n\n```\nBypass a function if it fails:\n```typescript\nbypass(addContextToError)(min3char('some text'))\n\n```\nRecovers a function if it fails:\n```typescript\nrecover(recoverToGood)(min3char('some text'))\n\n```\nFallback to a different function if the first fail:\n```typescript\norFallback(min3char, fallbackToUppercase)('some text')\n\n```\nConvert a simple transformer to a switch function:\n```typescript\ntransformToSwitch((value: number) =\u003e value * 2)(17)\n\n```\n\n## Documentation and links\n\n* [Code Maintenance :wrench:](MAINTENANCE.md)\n* [Code Of Conduct](CODE_OF_CONDUCT.md)\n* [Api for fairlie-functional](API.md)\n* [Contributing :busts_in_silhouette: :construction:](CONTRIBUTING.md)\n* [Diagram for the code base :triangular_ruler:](INTERNAL.md)\n* [Vocabulary used in the code base :book:](CODE_VOCABULARY.md)\n* [Architectural Decision Records :memo:](DECISIONS.md)\n* [Contributors :busts_in_silhouette:](https://github.com/flarebyte/fairlie-functional/graphs/contributors)\n* [Dependencies](https://github.com/flarebyte/fairlie-functional/network/dependencies)\n* [Glossary :book:](https://github.com/flarebyte/overview/blob/main/GLOSSARY.md)\n* [Software engineering principles :gem:](https://github.com/flarebyte/overview/blob/main/PRINCIPLES.md)\n* [Overview of Flarebyte.com ecosystem :factory:](https://github.com/flarebyte/overview)\n* [Npm dependencies](DEPENDENCIES.md)\n\n## Related\n\n\n## Installation\n\nThis package is [ESM only](https://blog.sindresorhus.com/get-ready-for-esm-aa53530b3f77).\n\n```bash\nyarn add fairlie-functional\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Ffairlie-functional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflarebyte%2Ffairlie-functional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Ffairlie-functional/lists"}