Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/okmttdhr/fp-minimal
Minimal typed functional programming in TypeScript
https://github.com/okmttdhr/fp-minimal
functional-programming typescript
Last synced: 28 days ago
JSON representation
Minimal typed functional programming in TypeScript
- Host: GitHub
- URL: https://github.com/okmttdhr/fp-minimal
- Owner: okmttdhr
- License: mit
- Created: 2019-12-10T09:24:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T19:03:19.000Z (over 3 years ago)
- Last Synced: 2024-10-08T21:50:35.744Z (about 1 month ago)
- Topics: functional-programming, typescript
- Language: TypeScript
- Homepage:
- Size: 403 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# fp-minimal
Minimal typed functional programming in TypeScript.
- 1.6KB mini library
- For people who don't want to install a lot of APIs just for function composition## Installation
```sh
yarn add fp-minimal
```## API
`fp-minimal` exposes only 2 functions.
### pipe
```ts
import { pipe } from 'fp-minimal';const double = (x: number) => x * 2;
const addOne = (x: number) => x + 1;
const square = (x: number) => x * x;pipe(double, addOne, square)(2) // 25
```### curry
```ts
import { curry } from 'fp-minimal';const add = (x: number, y: number) => x + y;
const addOne = curry(add)(1);addOne(2); // 3
[1, 2, 3].map(addOne); // [2, 3, 4]
```## License
MIT