Git Product home page Git Product logo

js-fp's Introduction

JS/FP

A pragmatic functional programming library for JavaScript/TypeScript

Computation with monad(-like) objects

Computation with one or two values

Box: computation with one value

Pair: computation with two values

Computation with n values

List: computation with zero, one or more values

NonEmptyList: computation with one or more values

Computation with error handling

Option: computation with a value that may be present or absent

Result: synchronous computation that may succeed or fail, short-circuits when a failure occurs

Validated: like Result, but accumulates errors instead of short-circuiting

Computation with a value and a context

State: stateful computation

Writer: computation with additional data (used for logging)

Writers

StringWriter: computation with log entries concatenated to a string

ListWriter: computation with log entries concatenated to a List instance

Asynchronous computation

Future: asynchronous computation that may succeed or fail (a monadic alternative to Promises)

High-level computation

Program: interpretation of program descriptions

Functions

Action: wrapper around a function with no parameters that enables composition

Arrow: wrapper around a function with one or more parameters that enables composition and adaptation of the input

Combination

Combination with semigroups

Semigroup: a type that supports an associative binary operation

objectCombination: a function to create combination schemes for objects based on semigroups

Combination with monoids

Monoid: a semigroup with an identity element

Boolean

All: combines two booleans using logical AND

Any: combines two booleans using logical OR

Number

Min: combines two numbers, resulting in the smallest of the two

Max: combines two numbers, resulting in the largest of the two

Sum: combines two numbers, resulting in the sum of the two

Product: combines two numbers, resulting in the product of the two

Date

Earliest: combines two dates, resulting in the earlier of the two

Latest: combines two dates, resulting in the later of the two

String

StringConcatenation: combines two string using concatenation

Array

ArrayConcatenation: combines two arrays using concatenation

List

ListConcatenation: combines two lists using concatenation

Testing

Equivalence

Equivalence: testing of equivalence between two values of the same type

objectEquivalence: a function to create equivalence schemes for objects based on member equivalences

Equalities for basic types: equalities for string, number, boolean and Date values and arrays of such values

Order

Order: decision on the order of two values

Ordering: a type alias for the three possible outcomes (-1, 0 and 1)

Predicate

Predicate: wrapper around predicate functions

js-fp's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.