๐Ÿ”ง Fast, modern, and practical utility library for FP in TypeScript.


Keywords
typescript, flow, functional-programming, functional, programming, fp, monad, option, option-type, result, result-type, array, utility, utils
License
MIT
Install
npm install @mobily/ts-belt@2.0.0-rc.9

Documentation

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

Module Namespace Description
Array A Utility functions for Array.
Boolean B Utility functions for Boolean.
Number N Utility functions for Number.
Object (Dict) D Utility functions for Object.
String S Utility functions for String.
Guards G Various TypeScript guards.
Option O Functions for handling the Option data type that represents the existence and nonexistence of a value.
Result R Functions for describing the result of a certain operation without relying on exceptions.
Function F Other 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


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