mobily/ts-belt

πŸ”§ Fast, modern, and practical utility library for FP in TypeScript.

TypeScript

1,200

448 commits

updated May 27, 2024

See the code

README

Build Status Coverage npm PRs Welcome All Contributors GitHub license

Fast, modern, and practical utility library for FP in TypeScript.

Documentation

Full documentation can be found here.

Features

  • πŸš€ built with ReScript, which generates highly performant JavaScript code (see the benchmark results here)
  • πŸ‘€ 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

yarn add @mobily/ts-belt

or with npm

npm install @mobily/ts-belt --save

Usage

ModuleNamespaceDescription
ArrayAUtility functions for Array.
BooleanBUtility functions for Boolean.
NumberNUtility functions for Number.
Object (Dict)DUtility functions for Object.
StringSUtility functions for String.
GuardsGVarious TypeScript guards.
OptionOFunctions for handling the Option data type that represents the existence and nonexistence of a value.
ResultRFunctions for describing the result of a certain operation without relying on exceptions.
FunctionFOther useful functions.
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

License

The MIT License.

See LICENSE

array
flow
fp
functional-programming
monad
option
option-type
result
result-type
typescript

mobily/ts-belt

πŸ”§ Fast, modern, and practical utility library for FP in TypeScript.

TypeScript

1,200

448 commits

updated May 27, 2024

See the code

README

Build Status Coverage npm PRs Welcome All Contributors GitHub license

Fast, modern, and practical utility library for FP in TypeScript.

Documentation

Full documentation can be found here.

Features

  • πŸš€ built with ReScript, which generates highly performant JavaScript code (see the benchmark results here)
  • πŸ‘€ 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

yarn add @mobily/ts-belt

or with npm

npm install @mobily/ts-belt --save

Usage

ModuleNamespaceDescription
ArrayAUtility functions for Array.
BooleanBUtility functions for Boolean.
NumberNUtility functions for Number.
Object (Dict)DUtility functions for Object.
StringSUtility functions for String.
GuardsGVarious TypeScript guards.
OptionOFunctions for handling the Option data type that represents the existence and nonexistence of a value.
ResultRFunctions for describing the result of a certain operation without relying on exceptions.
FunctionFOther useful functions.
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

License

The MIT License.

See LICENSE

array
flow
fp
functional-programming
monad
option
option-type
result
result-type
typescript

Project health

Overall

1.9/10

Maintained

0/10

Code review

0/10
OpenSSF Scorecard

Latest release

3.13.1 Β· Aug 2, 2022

Releases this year

0

Significant stargazers

Matteo Pietro Dazzi

241 followers Β· starred Apr 2025

Jonas Kello

40 followers Β· starred Oct 2023

Shahar Soel

106 followers Β· starred Jul 2023

Alain Armand

173 followers Β· starred May 2022