From c6a7a4e5e308ca001adf3d9ea10fe30543a79606 Mon Sep 17 00:00:00 2001 From: Ivan Novikov Date: Thu, 31 Dec 2020 13:32:30 -0500 Subject: [PATCH] docs(readme): minor edits --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1aef2c..be8411c 100644 --- a/README.md +++ b/README.md @@ -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