Skip to content

Commit

Permalink
feat: add forEach to fx
Browse files Browse the repository at this point in the history
  • Loading branch information
ppeeou committed Oct 14, 2024
1 parent e28b55e commit 7b9bdd4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Lazy/fx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,24 @@ class FxAsyncIterable<A> {

/**
* Iterates over AsyncIterable, applying each in turn to `f`.
* It works the same way as `forEach`.
*
* see {@link https://fxts.dev/docs/each | each}
*/
async each(f: (a: A) => unknown): Promise<void> {
return each(f, this.asyncIterable);
}

/**
* Iterates over AsyncIterable, applying each in turn to `f`.
* It works the same way as `each`.
*
* see {@link https://fxts.dev/docs/each | each}
*/
async forEach(f: (a: A) => unknown): Promise<void> {
return each(f, this.asyncIterable);
}

/**
* Takes item from AsyncIterable and returns an array.
*
Expand Down Expand Up @@ -516,13 +527,24 @@ export class FxIterable<A> {

/**
* Iterates over Iterable, applying each in turn to `f`.
* It works the same way as `forEach`.
*
* see {@link https://fxts.dev/docs/each | each}
*/
each(f: (a: A) => unknown): void {
return each(f, this.iterable);
}

/**
* Iterates over Iterable, applying each in turn to `f`.
* It works the same way as `each`.
*
* see {@link https://fxts.dev/docs/each | each}
*/
forEach(f: (a: A) => unknown): void {
return each(f, this.iterable);
}

/**
* Takes item from Iterable and returns an array.
*
Expand Down

0 comments on commit 7b9bdd4

Please sign in to comment.