From 208de203d67206393aeb479433d9f8ea7db5a0c0 Mon Sep 17 00:00:00 2001 From: hw Date: Mon, 25 Nov 2024 22:03:33 +0900 Subject: [PATCH] feat: support mapEffect --- src/Lazy/fx.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Lazy/fx.ts b/src/Lazy/fx.ts index f7f511e2..ac8a1a34 100644 --- a/src/Lazy/fx.ts +++ b/src/Lazy/fx.ts @@ -66,6 +66,15 @@ class FxAsyncIterable { return new FxAsyncIterable(map(f, this.asyncIterable)); } + /** + * A function that is identical to `map`, but is intended to create side effects as part of its convention. + * + * see {@link https://fxts.dev/docs/map | map} + */ + mapEffect(f: (a: A) => B) { + return new FxAsyncIterable(map(f, this.asyncIterable)); + } + /** * Returns flattened AsyncIterable of values by running each element * flattening the mapped results. @@ -366,6 +375,15 @@ export class FxIterable { return new FxIterable(map(f, this.iterable)); } + /** + * A function that is identical to `map`, but is intended to create side effects as part of its convention. + * + * see {@link https://fxts.dev/docs/map | map} + */ + mapEffect(f: (a: A) => B): FxIterable { + return new FxIterable(map(f, this.iterable)); + } + /** * Returns flattened Iterable of values by running each element * flattening the mapped results.