Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
/ figment Public archive

A handful of functional helpers for TypeScript

License

Notifications You must be signed in to change notification settings

tdreyno/figment

Repository files navigation

Figment

Test Coverage npm latest version

Figment is a collection of functional programming helpers. This is my personal collection of utilities and is not intended to be comprehensive.

The library is built in TypeScript and is manually curried to make the final parameter to functions (the data parameter) a separate callback to aid in composibility. For example, here is the signature of map from lodash:

type map = <T, U>(fn: (item: T) => U, items: T[]) => U[]
const increment = a => a + 1
const result = map(increment, [1, 2, 3])

And here is the signature this library uses:

type map = <T, U>(fn: (item: T) => U) => (items: T[]) => U[]
const increment = a => a + 1
const incrementList = map(increment)
const result = incrementList([1, 2, 3])

Installation

Yarn

yarn add @tdreyno/figment

NPM

npm install --save @tdreyno/figment

Prior Art

fp-ts is a popular TypeScript library which implements functional concepts.

License

Figment is licensed under the Hippocratic License. It is an Ethical Source license derived from the MIT License, amended to limit the impact of the unethical use of open source software.