uinix-fp-map
v1.0.0
Published
uinix fp array map utility
Downloads
2
Readme
uinix-fp-map
uinix-fp
array map utility.
Install
This package is ESM-only and requires Node 12+.
npm install uinix-fp-map
Use
import {map} from 'uinix-fp-map';
const square = x => x ** 2;
map(square)([1, 2, 3]); // [1, 4, 9]
const mapSquare = map(square); // curried
mapSquare([1, 2, 3]); // [1, 4, 9]
API
This package exports the following identifiers: map
. There is no default export.
map(f)(xs)
Parameters (Curried)
f
((x: X) => Y
): The mapping functionx
(X
): Any value
Returns
Y[]
— Array of values returned by the mapping function