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 7, 2020
1 parent aa92215 commit b56c587
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,16 @@ It also provides implementations of `EqualFunction` for objects, iterables, maps

## Reducers

The library exports a type `Reducer` which is like a regular reducer, but can return `undefined` to stop the iteration short, and which is used by functions [`reduceIterable`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/iterable/reduceIterable.ts) and [`scanIterable`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/iterable/scanIterable.ts).
The library exports a type

```ts
type Reducer<Accumulator, Element> = (
accumulator: Accumulator,
element: Element,
) => Accumulator | undefined;
```

which is like a regular reducer, but can return `undefined` to stop the iteration short, and which is used by functions [`reduceIterable`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/iterable/reduceIterable.ts) and [`scanIterable`](https://github.com/ivan7237d/antiutils/blob/master/src/internal/iterable/scanIterable.ts).

The library includes [basic implementations of this type](https://github.com/ivan7237d/antiutils/blob/master/src/internal/reducer), all of which except the boolean ones (`andReducer` and `orReducer`) can also be used with arrays and observables.

Expand Down

0 comments on commit b56c587

Please sign in to comment.