Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mobily/ts-belt
π§ Fast, modern, and practical utility library for FP in TypeScript.
https://github.com/mobily/ts-belt
array flow fp functional-programming monad option option-type result result-type typescript
Last synced: about 8 hours ago
JSON representation
π§ Fast, modern, and practical utility library for FP in TypeScript.
- Host: GitHub
- URL: https://github.com/mobily/ts-belt
- Owner: mobily
- License: mit
- Created: 2020-11-30T10:52:03.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-27T03:59:46.000Z (6 months ago)
- Last Synced: 2024-11-06T02:56:42.311Z (7 days ago)
- Topics: array, flow, fp, functional-programming, monad, option, option-type, result, result-type, typescript
- Language: TypeScript
- Homepage: https://mobily.github.io/ts-belt
- Size: 16.2 MB
- Stars: 1,115
- Watchers: 14
- Forks: 31
- Open Issues: 50
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - mobily/ts-belt - π§ Fast, modern, and practical utility library for FP in TypeScript. (TypeScript)
README
Fast, modern, and practical utility library for FP in TypeScript.## Documentation
Full documentation can be found [here](https://mobily.github.io/ts-belt/).
## Features
- π built with `ReScript`, which generates highly performant JavaScript code (see the benchmark results [here](https://mobily.github.io/ts-belt/benchmarks/introduction))
- π provides more readable code, due to the `data-first` approach
- β¨ supports `TypeScript` and `Flow`
- π‘ helps you write safer code with `Option` and `Result` types
- π― all functions return immutable data (no side-effects)
- π² tree-shakeable
- π fully documented## Getting started
### Installation
```shell
yarn add @mobily/ts-belt
```or with `npm`
```shell
npm install @mobily/ts-belt --save
```### Usage
| Module | Namespace | Description |
|--|-----------|--|
| [Array](https://mobily.github.io/ts-belt/api/array) | A | Utility functions for `Array`. |
| [Boolean](https://mobily.github.io/ts-belt/api/boolean) | B | Utility functions for `Boolean`. |
| [Number](https://mobily.github.io/ts-belt/api/number) | N | Utility functions for `Number`. |
| [Object (Dict)](https://mobily.github.io/ts-belt/api/object) | D | Utility functions for `Object`. |
| [String](https://mobily.github.io/ts-belt/api/string) | S | Utility functions for `String`. |
| [Guards](https://mobily.github.io/ts-belt/api/guards) | G | Various TypeScript guards. |
| [Option](https://mobily.github.io/ts-belt/api/option) | O | Functions for handling the `Option` data type that represents the existence and nonexistence of a value. |
| [Result](https://mobily.github.io/ts-belt/api/result) | R | Functions for describing the result of a certain operation without relying on exceptions. |
| [Function](https://mobily.github.io/ts-belt/api/function) | F | Other useful functions. |```typescript
import { A, O, N, pipe } from '@mobily/ts-belt'pipe(
[1, 2, 3, 4, 5], // β [1, 2, 3, 4, 5]
A.dropExactly(2), // β Some([3, 4, 5])
O.flatMap(A.head), // β Some(3)
O.map(N.multiply(10)), // β Some(30)
O.getWithDefault(0), // β 30
) // β 30
```## Contributors
Marcin Dziewulski
π» π β οΈ π¨ π§
Krzysztof Lenda
π
Radek KozieΕ
π
Artur
π
Dominik ΕopaciΕski
π» π β οΈ
Jakub WΔ sik
π
Krystian Mateusiak
π» π β οΈ
MichaΕ Miszczyszyn
π€
Kevin
π
Anthony Khong
π» π β οΈ
Pyrolistical
π π§ π€
Mathieu Acthernoene
π€
## License
The MIT License.
See [LICENSE](LICENSE)