From aaf06d3d75b1786f0570f69a699de8651c9d7a1c Mon Sep 17 00:00:00 2001 From: Rowan Gudmundsson <145883470+rowan-gud@users.noreply.github.com> Date: Tue, 27 Feb 2024 22:58:59 -0800 Subject: [PATCH] feat: add map function (#1) Release-As: 1.0.0-rc.1 --- src/fp/index.ts | 3 ++- src/fp/map.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/fp/map.ts diff --git a/src/fp/index.ts b/src/fp/index.ts index 66ab1bd..c40c661 100644 --- a/src/fp/index.ts +++ b/src/fp/index.ts @@ -1 +1,2 @@ -export * from "./pipe"; +export * from './map'; +export * from './pipe'; diff --git a/src/fp/map.ts b/src/fp/map.ts new file mode 100644 index 0000000..9a3493f --- /dev/null +++ b/src/fp/map.ts @@ -0,0 +1,6 @@ +export function map( + fn: (item: T[number]) => Res, + items: T, +): Res[] { + return items.map(fn); +}