From ad31ed803cf573853cedd858e72171a3ea911a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Tou=C5=A1ek?= Date: Fri, 11 Oct 2019 20:30:42 +0200 Subject: [PATCH] Add toArray documentation (#286) --- docs/iterators/transformation.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/iterators/transformation.md b/docs/iterators/transformation.md index 91b1b51..c1d9f74 100644 --- a/docs/iterators/transformation.md +++ b/docs/iterators/transformation.md @@ -3,9 +3,9 @@ layout: docs title: Iterator Transformation permalink: /iterators/transformation --- -Amp provides two common transformation helpers for iterators: `map` and `filter`. +Amp provides some common transformation helpers for iterators: `map`, `filter` and `toArray`. -Further primitives are very easy to implement using `Producer` with those two as examples. +Further primitives are very easy to implement using `Producer` with these as examples. ## `map()` @@ -14,3 +14,7 @@ Further primitives are very easy to implement using `Producer` with those two as ## `filter()` `filter()` accepts an `Iterator` and a `callable` `$filter`. If `$filter($value)` returns `false` the value gets filtered, otherwise the value is retained in the resulting `Iterator`. + +## `toArray()` + +`toArray()` accepts an `Iterator` and returns a `Promise` which resolves to an array of all the items from the iterator.