Giter Site home page Giter Site logo

mobily / ts-belt Goto Github PK

View Code? Open in Web Editor NEW
1.1K 12.0 30.0 16.58 MB

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

Home Page: https://mobily.github.io/ts-belt

License: MIT License

JavaScript 9.26% TypeScript 75.48% Shell 0.23% ReScript 14.89% Reason 0.15%
typescript functional-programming fp monad option option-type result result-type array flow

ts-belt's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.