Socket
Socket
Sign inDemoInstall

@mobily/ts-belt

Package Overview
Dependencies
0
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @mobily/ts-belt

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


Version published
Weekly downloads
42K
increased by8.43%
Maintainers
1
Install size
372 kB
Created
Weekly downloads
 

Readme

Source

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


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

Keywords

FAQs

Last updated on 02 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc