0.1.0 • Published 11 months ago
fairlie-functional v0.1.0
fairlie-functional
A lightweight functional library in typescript that helps dealing with failures the rail way
A lightweight functional library in typescript that helps dealing with failures the rail way
Highlights:
- A take on Railway Oriented Programming (ROP) in typescript
- Each function will always yield a failure or a success
- You can easily combine multiple functions into a single unit using operators
- Support for promises
A few examples of commands:
Bind two switch functions:
bindTwo(min3char, valueifyShort)('some text')
Bind three switch functions:
bindThree(min3char, max20char, valueifyShort)('some text')
Bind three similar switch functions:
bindSimilar([min3char, max20char, notDot])('some text')
Bypass a function if it fails:
bypass(addContextToError)(min3char('some text'))
Recovers a function if it fails:
recover(recoverToGood)(min3char('some text'))
Fallback to a different function if the first fail:
orFallback(min3char, fallbackToUppercase)('some text')
Convert a simple transformer to a switch function:
transformToSwitch((value: number) => value * 2)(17)
Documentation and links
- Code Maintenance :wrench:
- Code Of Conduct
- Api for fairlie-functional
- Contributing :busts_in_silhouette: :construction:
- Diagram for the code base :triangular_ruler:
- Vocabulary used in the code base :book:
- Architectural Decision Records :memo:
- Contributors :busts_in_silhouette:
- Dependencies
- Glossary :book:
- Software engineering principles :gem:
- Overview of Flarebyte.com ecosystem :factory:
- Npm dependencies
Related
Installation
This package is ESM only.
yarn add fairlie-functional
0.1.0
11 months ago