Skip to content

Commit

Permalink
docs(readme): minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan7237d committed Dec 31, 2020
1 parent af9583f commit c6a7a4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ How-to:

- **Count elements in an iterable:**: `applyPipe(yourIterable, reduceIterable(countReducer, 0))`.

- **Check if every element in an iterable is true:** `applyPipe(yourIterableOfBooleans, reduceIterable(andReducer, true))` (iteration will not continue unnecessarily because of how [`reduceIterable`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/iterable/reduceIterable.ts) and [`andReducer`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/reducer/andReducer.ts) are defined).
- **Check if every element in an iterable is true:** `applyPipe(yourIterableOfBooleans, reduceIterable(andReducer, true))` (iteration will not continue unnecessarily because of [how a reducer is defined](#reducers)).

- **Check if some elements in an iterable are true:** `applyPipe(yourIterableOfBooleans, reduceIterable(orReducer, false))`.

- **Find the first element matching a predicate:** `applyPipe(yourIterable, filter(yourPredicate), firstInIterable)`.

- **Same as above, but throw an error if the iterable has multiple matching elements:** `applyPipe(yourIterable, filter(yourPredicate), reduceIterable(asContext(() => { throw yourError; })))` (`asContext` is described in the section ["Functions for downcasting"](#functions-for-downcasting)).

- **Yield values while a condition holds:**

```ts
Expand Down

0 comments on commit c6a7a4e

Please sign in to comment.