0.2.0 • Published 2 months ago

lambda-craft v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Features

  • 👀 provides more readable code, due to the data-first approach
  • ✨ supports TypeScript
  • 🛡 helps you write safer code with Maybe and Either types
  • 🎯 all functions return immutable data (no side-effects)
  • 🌲 tree-shakeable

Getting started

Installation

yarn add lambda-craft

or with npm

npm install lambda-craft --save

Usage

ModuleNamespaceDescription
ArrayArrUtility functions for Array.
Object (Dict)DictUtility functions for Object.
MaybeMaybeFunctions for handling the Maybe data type that represents the existence and nonexistence of a value.
EitherEitherFunctions for describing the Either of a certain operation without relying on exceptions.
TaskTaskFunctions for describing the asynchoronous operations.

Example

import { pipe, Maybe, Arr } from 'lambda-craft'

const r = pipe(
  Arr.of(1, 2, 3, 4, 5), // -> [1,2,3,4,5]
  Arr.take(2),  // -> [1,2]
  Arr.find(n => n == 1), // -> Maybe(1)
  Maybe.map(n => n * 10), // -> Maybe(10)
  Maybe.getOrDefault<number>(5), // -> 10
)

License

The MIT License.

See LICENSE

0.2.0

2 months ago

0.1.0

3 months ago