itertools 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,13 +21,12 @@ Usage example:
21
21
  4 'there'
22
22
  ```
23
23
 
24
-
25
24
  ## About argument order
26
25
 
27
- In Python, many of the itertools take a function as an argument. In the JS
26
+ In Python, many of the itertools take a function as an argument. In the JS
28
27
  port of these we initially kept these orderings the same to stick closely to
29
28
  the Python functions, but in practice, it turns out to be more pragmatic to
30
- flip them, so the function gets to be the second param. Example:
29
+ flip them, so the function gets to be the second param. Example:
31
30
 
32
31
  In Python:
33
32
 
@@ -49,14 +48,12 @@ remaing aesthetically pleasing:
49
48
  import { map } from 'itertools';
50
49
 
51
50
  const numbers = [1, 2, 3];
52
- const squares = map(numbers, n => {
53
-
51
+ const squares = map(numbers, (n) => {
54
52
  //
55
53
  // Do something wild with these numbers here
56
54
  //
57
55
  // ...
58
56
  return n * n;
59
-
60
57
  });
61
58
  ```
62
59
 
@@ -64,76 +61,73 @@ const squares = map(numbers, n => {
64
61
 
65
62
  The `itertools` package consists of a few building blocks:
66
63
 
67
- * [Ports of builtins](#ports-of-builtins)
68
- * [Ports of itertools](#ports-of-itertools)
69
- * [Ports of more-itertools](#ports-of-more-itertools)
70
- * [Additions](#additions)
71
-
64
+ - [Ports of builtins](#ports-of-builtins)
65
+ - [Ports of itertools](#ports-of-itertools)
66
+ - [Ports of more-itertools](#ports-of-more-itertools)
67
+ - [Additions](#additions)
72
68
 
73
69
  ### Ports of builtins
74
70
 
75
- * [every](#every)
76
- * [some](#some)
77
- * [contains](#contains)
78
- * [enumerate](#enumerate)
79
- * [filter](#filter)
80
- * [iter](#iter)
81
- * [map](#map)
82
- * [max](#max)
83
- * [min](#min)
84
- * [range](#range)
85
- * [reduce](#reduce)
86
- * [sorted](#sorted)
87
- * [sum](#sum)
88
- * [zip](#zip)
89
- * [zip3](#zip3)
90
-
91
- <a name="every" href="#every">#</a> <b>every</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
92
-
93
- Returns true when every of the items in iterable are truthy. An optional key
71
+ - [every](#every)
72
+ - [some](#some)
73
+ - [contains](#contains)
74
+ - [enumerate](#enumerate)
75
+ - [filter](#filter)
76
+ - [iter](#iter)
77
+ - [map](#map)
78
+ - [max](#max)
79
+ - [min](#min)
80
+ - [range](#range)
81
+ - [reduce](#reduce)
82
+ - [sorted](#sorted)
83
+ - [sum](#sum)
84
+ - [zip](#zip)
85
+ - [zip3](#zip3)
86
+
87
+ <a name="every" href="#every">#</a> <b>every</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
88
+
89
+ Returns true when every of the items in iterable are truthy. An optional key
94
90
  function can be used to define what truthiness means for this specific
95
91
  collection.
96
92
 
97
93
  Examples:
98
94
 
99
95
  ```ts
100
- every([]) // => true
101
- every([0]) // => false
102
- every([0, 1, 2]) // => false
103
- every([1, 2, 3]) // => true
96
+ every([]); // => true
97
+ every([0]); // => false
98
+ every([0, 1, 2]); // => false
99
+ every([1, 2, 3]); // => true
104
100
  ```
105
101
 
106
102
  Examples with using a key function:
107
103
 
108
104
  ```ts
109
- every([2, 4, 6], n => n % 2 === 0) // => true
110
- every([2, 4, 5], n => n % 2 === 0) // => false
105
+ every([2, 4, 6], (n) => n % 2 === 0); // => true
106
+ every([2, 4, 5], (n) => n % 2 === 0); // => false
111
107
  ```
112
108
 
109
+ <a name="some" href="#some">#</a> <b>some</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
113
110
 
114
- <a name="some" href="#some">#</a> <b>some</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
115
-
116
- Returns true when some of the items in iterable are truthy. An optional key
111
+ Returns true when some of the items in iterable are truthy. An optional key
117
112
  function can be used to define what truthiness means for this specific
118
113
  collection.
119
114
 
120
115
  Examples:
121
116
 
122
117
  ```ts
123
- some([]) // => false
124
- some([0]) // => false
125
- some([0, 1, null, undefined]) // => true
118
+ some([]); // => false
119
+ some([0]); // => false
120
+ some([0, 1, null, undefined]); // => true
126
121
  ```
127
122
 
128
123
  Examples with using a key function:
129
124
 
130
125
  ```ts
131
- some([1, 4, 5], n => n % 2 === 0) // => true
132
- some([{name: 'Bob'}, {name: 'Alice'}], person => person.name.startsWith('C')) // => false
126
+ some([1, 4, 5], (n) => n % 2 === 0); // => true
127
+ some([{ name: 'Bob' }, { name: 'Alice' }], (person) => person.name.startsWith('C')); // => false
133
128
  ```
134
129
 
135
-
136
- <a name="contains" href="#contains">#</a> <b>contains</b>(haystack: <i>Iterable&lt;T&gt;</i>, needle: <i>T</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
130
+ <a name="contains" href="#contains">#</a> <b>contains</b>(haystack: <i>Iterable&lt;T&gt;</i>, needle: <i>T</i>): <i>boolean</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
137
131
 
138
132
  Returns true when some of the items in the iterable are equal to the target
139
133
  object.
@@ -141,17 +135,16 @@ object.
141
135
  Examples:
142
136
 
143
137
  ```ts
144
- contains([], 'whatever') // => false
145
- contains([3], 42) // => false
146
- contains([3], 3) // => true
147
- contains([0, 1, 2], 2) // => true
138
+ contains([], 'whatever'); // => false
139
+ contains([3], 42); // => false
140
+ contains([3], 3); // => true
141
+ contains([0, 1, 2], 2); // => true
148
142
  ```
149
143
 
144
+ <a name="enumerate" href="#enumerate">#</a> <b>enumerate</b>(iterable: <i>Iterable&lt;T&gt;</i>, start: <i>number = 0</i>): <i>Iterable&lt;[number, T]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
150
145
 
151
- <a name="enumerate" href="#enumerate">#</a> <b>enumerate</b>(iterable: <i>Iterable&lt;T&gt;</i>, start: <i>number = 0</i>): <i>Iterable&lt;[number, T]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
152
-
153
- Returns an iterable of enumeration pairs. Iterable must be a sequence, an
154
- iterator, or some other object which supports iteration. The elements produced
146
+ Returns an iterable of enumeration pairs. Iterable must be a sequence, an
147
+ iterator, or some other object which supports iteration. The elements produced
155
148
  by returns a tuple containing a counter value (starting from 0 by default) and
156
149
  the values obtained from iterating over given iterable.
157
150
 
@@ -164,28 +157,25 @@ console.log([...enumerate(['hello', 'world'])]);
164
157
  // [0, 'hello'], [1, 'world']]
165
158
  ```
166
159
 
167
- <a name="filter" href="#filter">#</a> <b>filter</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>Array&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
160
+ <a name="filter" href="#filter">#</a> <b>filter</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>T[]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
168
161
 
169
- Non-lazy version of [ifilter](#ifilter).
162
+ Eager version of [ifilter](#ifilter).
170
163
 
164
+ <a name="iter" href="#iter">#</a> <b>iter</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterator&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
171
165
 
172
- <a name="iter" href="#iter">#</a> <b>iter</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterator&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
173
-
174
- Returns an iterator object for the given iterable. This can be used to
175
- manually get an iterator for any iterable datastructure. The purpose and main
166
+ Returns an iterator object for the given iterable. This can be used to
167
+ manually get an iterator for any iterable datastructure. The purpose and main
176
168
  use case of this function is to get a single iterator (a thing with state,
177
169
  think of it as a "cursor") which can only be consumed once.
178
170
 
171
+ <a name="map" href="#map">#</a> <b>map</b>(iterable: _Iterable&lt;T&gt;_, mapper: _(item: T) =&gt; V_): _V[]_ [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
179
172
 
180
- <a name="map" href="#map">#</a> <b>map</b>(iterable: _Iterable&lt;T&gt;_, mapper: _T =&gt; V_): _Array&lt;V&gt;_ [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
181
-
182
- Non-lazy version of [imap](#imap).
183
-
173
+ Eager version of [imap](#imap).
184
174
 
185
- <a name="max" href="#max">#</a> <b>max</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>T =&gt; number</i>): <i>Maybe&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
175
+ <a name="max" href="#max">#</a> <b>max</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>(item: T) =&gt; number</i>): <i>T | undefined</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
186
176
 
187
- Return the largest item in an iterable. Only works for numbers, as ordering is
188
- pretty poorly defined on any other data type in JS. The optional `keyFn`
177
+ Return the largest item in an iterable. Only works for numbers, as ordering is
178
+ pretty poorly defined on any other data type in JS. The optional `keyFn`
189
179
  argument specifies a one-argument ordering function like that used for
190
180
  [sorted](#sorted).
191
181
 
@@ -194,11 +184,10 @@ If the iterable is empty, `undefined` is returned.
194
184
  If multiple items are maximal, the function returns either one of them, but
195
185
  which one is not defined.
196
186
 
187
+ <a name="min" href="#min">#</a> <b>min</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>(item: T) =&gt; number</i>): <i>T | undefined</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
197
188
 
198
- <a name="min" href="#min">#</a> <b>min</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>T =&gt; number</i>): <i>Maybe&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
199
-
200
- Return the smallest item in an iterable. Only works for numbers, as ordering
201
- is pretty poorly defined on any other data type in JS. The optional `keyFn`
189
+ Return the smallest item in an iterable. Only works for numbers, as ordering
190
+ is pretty poorly defined on any other data type in JS. The optional `keyFn`
202
191
  argument specifies a one-argument ordering function like that used for
203
192
  [sorted](#sorted).
204
193
 
@@ -207,9 +196,8 @@ If the iterable is empty, `undefined` is returned.
207
196
  If multiple items are minimal, the function returns either one of them, but
208
197
  which one is not defined.
209
198
 
210
-
211
- <a name="range" href="#range">#</a> <b>range</b>(stop: <i>number</i>): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")<br />
212
- <a name="range" href="#range">#</a> <b>range</b>(start: <i>number</i>, stop: <i>number</i>, step: <i>number</i> = 1): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
199
+ <a name="range" href="#range">#</a> <b>range</b>(stop: <i>number</i>): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')<br />
200
+ <a name="range" href="#range">#</a> <b>range</b>(start: <i>number</i>, stop: <i>number</i>, step: <i>number</i> = 1): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
213
201
 
214
202
  Returns an iterator producing all the numbers in the given range one by one,
215
203
  starting from `start` (default 0), as long as `i < stop`, in increments of
@@ -234,19 +222,14 @@ the stop condition `n > stop` is satisfied.
234
222
  The produced range will be empty if the first value to produce already does not
235
223
  meet the value constraint.
236
224
 
237
-
238
- <a name="reduce" href="#reduce">#</a> <b>reduce</b>(iterable: <i>Iterable&lt;T&gt;</i>, reducer: <i>(O, T, number) =&gt; O</i>, start: <i>O</i>): <i>O</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")<br />
239
- <a name="reduce" href="#reduce">#</a> <b>reduce</b>(iterable: <i>Iterable&lt;T&gt;</i>, reducer: <i>(T, T, number) =&gt; T</i>): <i>Maybe&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
225
+ <a name="reduce" href="#reduce">#</a> <b>reduce</b>(iterable: <i>Iterable&lt;T&gt;</i>, reducer: <i>(O, T, number) =&gt; O</i>, start: <i>O</i>): <i>O</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')<br />
226
+ <a name="reduce" href="#reduce">#</a> <b>reduce</b>(iterable: <i>Iterable&lt;T&gt;</i>, reducer: <i>(T, T, number) =&gt; T</i>): <i>T | undefined</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
240
227
 
241
228
  Apply function of two arguments cumulatively to the items of sequence, from
242
- left to right, so as to reduce the sequence to a single value. For example:
229
+ left to right, so as to reduce the sequence to a single value. For example:
243
230
 
244
231
  ```ts
245
- reduce(
246
- [1, 2, 3, 4, 5],
247
- (total, x) => total + x,
248
- 0
249
- )
232
+ reduce([1, 2, 3, 4, 5], (total, x) => total + x, 0);
250
233
  ```
251
234
 
252
235
  calculates
@@ -259,99 +242,87 @@ The left argument, `total`, is the accumulated value and the right argument,
259
242
  Without an explicit initializer arg:
260
243
 
261
244
  ```ts
262
- reduce(
263
- [1, 2, 3, 4, 5],
264
- (total, x) => total + x
265
- )
245
+ reduce([1, 2, 3, 4, 5], (total, x) => total + x);
266
246
  ```
267
247
 
268
248
  it calculates
269
249
 
270
250
  ((((1+2)+3)+4)+5)
271
251
 
272
-
273
-
274
- <a name="sorted" href="#sorted">#</a> <b>sorted</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>T =&gt; Primitive</i></i>, reverse?: <i>boolean</i>): <i>Array&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
252
+ <a name="sorted" href="#sorted">#</a> <b>sorted</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>(item: T) =&gt; Primitive</i></i>, reverse?: <i>boolean</i>): <i>T[]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
275
253
 
276
254
  Return a new sorted list from the items in iterable.
277
255
 
278
256
  Has two optional arguments:
279
257
 
280
- * `keyFn` specifies a function of one argument providing a primitive identity
281
- for each element in the iterable. that will be used to compare. The default
282
- value is to use a default identity function that is only defined for
283
- primitive types.
258
+ - `keyFn` specifies a function of one argument providing a primitive identity
259
+ for each element in the iterable. that will be used to compare. The default
260
+ value is to use a default identity function that is only defined for
261
+ primitive types.
284
262
 
285
- * `reverse` is a boolean value. If `true`, then the list elements are sorted
286
- as if each comparison were reversed.
263
+ - `reverse` is a boolean value. If `true`, then the list elements are sorted
264
+ as if each comparison were reversed.
287
265
 
266
+ <a name="sum" href="#sum">#</a> <b>sum</b>(iterable: <i>Iterable&lt;number&gt;</i>): <i>number</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
288
267
 
289
- <a name="sum" href="#sum">#</a> <b>sum</b>(iterable: <i>Iterable&lt;number&gt;</i>): <i>number</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
290
-
291
- Sums the items of an iterable from left to right and returns the total. The
268
+ Sums the items of an iterable from left to right and returns the total. The
292
269
  sum will defaults to 0 if the iterable is empty.
293
270
 
271
+ <a name="zip" href="#zip">#</a> <b>zip</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>): <i>[T1, T2][]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')<br />
272
+ <a name="zip3" href="#zip3">#</a> <b>zip3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>): <i>[T1, T2, T3][]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js 'Source')
294
273
 
295
- <a name="zip" href="#zip">#</a> <b>zip</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>): <i>Array&lt;[T1, T2]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")<br />
296
- <a name="zip3" href="#zip3">#</a> <b>zip3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>): <i>Array&lt;[T1, T2, T3]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/builtins.js "Source")
297
-
298
- Non-lazy version of [izip](#izip) / [izip3](#izip3).
299
-
274
+ Eager version of [izip](#izip) / [izip3](#izip3).
300
275
 
301
276
  ### Ports of itertools
302
277
 
303
- * [chain](#chain)
304
- * [compress](#compress)
305
- * [count](#count)
306
- * [cycle](#cycle)
307
- * [dropwhile](#dropwhile)
308
- * [groupby](#groupby)
309
- * [icompress](#icompress)
310
- * [ifilter](#ifilter)
311
- * [imap](#imap)
312
- * [islice](#islice)
313
- * [izip](#izip)
314
- * [izip3](#izip3)
315
- * [izipLongest](#izipLongest)
316
- * [izipMany](#izipMany)
317
- * [permutations](#permutations)
318
- * [repeat](#repeat)
319
- * [takewhile](#takewhile)
320
- * [zipLongest](#zipLongest)
321
- * [zipMany](#zipMany)
322
-
323
- <a name="chain" href="#chain">#</a> <b>chain</b>(...iterables: <i>Array&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
278
+ - [chain](#chain)
279
+ - [compress](#compress)
280
+ - [count](#count)
281
+ - [cycle](#cycle)
282
+ - [dropwhile](#dropwhile)
283
+ - [groupby](#groupby)
284
+ - [icompress](#icompress)
285
+ - [ifilter](#ifilter)
286
+ - [imap](#imap)
287
+ - [islice](#islice)
288
+ - [izip](#izip)
289
+ - [izip3](#izip3)
290
+ - [izipLongest](#izipLongest)
291
+ - [izipMany](#izipMany)
292
+ - [permutations](#permutations)
293
+ - [repeat](#repeat)
294
+ - [takewhile](#takewhile)
295
+ - [zipLongest](#zipLongest)
296
+ - [zipMany](#zipMany)
297
+
298
+ <a name="chain" href="#chain">#</a> <b>chain</b>(...iterables: <i>Iterable&lt;T&gt;[]</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
324
299
 
325
300
  Returns an iterator that returns elements from the first iterable until it is
326
301
  exhausted, then proceeds to the next iterable, until all of the iterables are
327
- exhausted. Used for treating consecutive sequences as a single sequence.
328
-
329
-
330
- <a name="compress" href="#compress">#</a> <b>compress</b>(iterable: <i>Iterable&lt;T&gt;</i>, selectors: <i>Iterable&lt;boolean&gt;</i>): <i>Array&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
302
+ exhausted. Used for treating consecutive sequences as a single sequence.
331
303
 
332
- Non-lazy version of [icompress](#icompress).
304
+ <a name="compress" href="#compress">#</a> <b>compress</b>(iterable: <i>Iterable&lt;T&gt;</i>, selectors: <i>Iterable&lt;boolean&gt;</i>): <i>T[]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
333
305
 
306
+ Eager version of [icompress](#icompress).
334
307
 
335
- <a name="count" href="#count">#</a> <b>count</b>(start: <i>number</i>, step: <i>number</i>): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
308
+ <a name="count" href="#count">#</a> <b>count</b>(start: <i>number</i>, step: <i>number</i>): <i>Iterable&lt;number&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
336
309
 
337
310
  Returns an iterator that counts up values starting with number `start` (default
338
- 0), incrementing by `step`. To decrement, use a negative step number.
311
+ 0), incrementing by `step`. To decrement, use a negative step number.
339
312
 
340
-
341
- <a name="cycle" href="#cycle">#</a> <b>cycle</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
313
+ <a name="cycle" href="#cycle">#</a> <b>cycle</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
342
314
 
343
315
  Returns an iterator producing elements from the iterable and saving a copy of
344
- each. When the iterable is exhausted, return elements from the saved copy.
316
+ each. When the iterable is exhausted, return elements from the saved copy.
345
317
  Repeats indefinitely.
346
318
 
347
-
348
- <a name="dropwhile" href="#dropwhile">#</a> <b>dropwhile</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>T =&gt; bool</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
319
+ <a name="dropwhile" href="#dropwhile">#</a> <b>dropwhile</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>(item: T) =&gt; boolean</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
349
320
 
350
321
  Returns an iterator that drops elements from the iterable as long as the
351
- predicate is true; afterwards, returns every remaining element. **Note:** the
322
+ predicate is true; afterwards, returns every remaining element. **Note:** the
352
323
  iterator does not produce any output until the predicate first becomes false.
353
324
 
354
- <a name="groupby" href="#groupby">#</a> <b>groupby</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFcn: <i>T =&gt; Primitive</i>): <i>Iterable&lt;[Primitive, Iterable&lt;T&gt;]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
325
+ <a name="groupby" href="#groupby">#</a> <b>groupby</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFcn: <i>(item: T) =&gt; Primitive</i>): <i>Iterable&lt;[Primitive, Iterable&lt;T&gt;]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
355
326
 
356
327
  Make an Iterable that returns consecutive keys and groups from the iterable.
357
328
  The key is a function computing a key value for each element. If not specified,
@@ -367,116 +338,102 @@ common elements regardless of their input order.
367
338
  The returned group is itself an iterator that shares the underlying iterable
368
339
  with `groupby()`. Because the source is shared, when the `groupby()` object is
369
340
  advanced, the previous group is no longer visible. So, if that data is needed
370
- later, it should be stored as an Array.
371
-
341
+ later, it should be stored as an array.
372
342
 
373
- <a name="icompress" href="#icompress">#</a> <b>icompress</b>(iterable: <i>Iterable&lt;T&gt;</i>, selectors: <i>Iterable&lt;boolean&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
343
+ <a name="icompress" href="#icompress">#</a> <b>icompress</b>(iterable: <i>Iterable&lt;T&gt;</i>, selectors: <i>Iterable&lt;boolean&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
374
344
 
375
345
  Returns an iterator that filters elements from data returning only those that
376
- have a corresponding element in selectors that evaluates to `true`. Stops when
346
+ have a corresponding element in selectors that evaluates to `true`. Stops when
377
347
  either the data or selectors iterables has been exhausted.
378
348
 
379
-
380
- <a name="ifilter" href="#ifilter">#</a> <b>ifilter</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
349
+ <a name="ifilter" href="#ifilter">#</a> <b>ifilter</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
381
350
 
382
351
  Returns an iterator that filters elements from iterable returning only those
383
352
  for which the predicate is true.
384
353
 
385
- <a name="imap" href="#imap">#</a> <b>imap</b>(iterable: <i>Iterable&lt;T&gt;</i>, mapper: <i>T =&gt; V</i>): <i>Iterable&lt;V&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
354
+ <a name="imap" href="#imap">#</a> <b>imap</b>(iterable: <i>Iterable&lt;T&gt;</i>, mapper: <i>(item: T) =&gt; V</i>): <i>Iterable&lt;V&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
386
355
 
387
356
  Returns an iterator that computes the given mapper function using arguments
388
357
  from each of the iterables.
389
358
 
359
+ <a name="islice" href="#islice">#</a> <b>islice</b>(iterable: <i>Iterable&lt;T&gt;</i>[start: <i>number</i>], stop: <i>number</i>[, step: <i>number</i>]): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
390
360
 
391
- <a name="islice" href="#islice">#</a> <b>islice</b>(iterable: <i>Iterable&lt;T&gt;</i>[start: <i>number</i>], stop: <i>number</i>[, step: <i>number</i>]): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
392
-
393
- Returns an iterator that returns selected elements from the iterable. If
361
+ Returns an iterator that returns selected elements from the iterable. If
394
362
  `start` is non-zero, then elements from the iterable are skipped until start is
395
- reached. Then, elements are returned by making steps of `step` (defaults to
396
- 1). If set to higher than 1, items will be skipped. If `stop` is provided,
363
+ reached. Then, elements are returned by making steps of `step` (defaults to
364
+ 1). If set to higher than 1, items will be skipped. If `stop` is provided,
397
365
  then iteration continues until the iterator reached that index, otherwise, the
398
- iterable will be fully exhausted. `islice()` does not support negative values
366
+ iterable will be fully exhausted. `islice()` does not support negative values
399
367
  for `start`, `stop`, or `step`.
400
368
 
369
+ <a name="izip" href="#izip">#</a> <b>izip</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>): <i>Iterable&lt;[T1, T2]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')<br />
370
+ <a name="izip3" href="#izip3">#</a> <b>izip3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>): <i>Iterable&lt;[T1, T2, T3]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
401
371
 
402
- <a name="izip" href="#izip">#</a> <b>izip</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>): <i>Iterable&lt;[T1, T2]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")<br />
403
- <a name="izip3" href="#izip3">#</a> <b>izip3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>): <i>Iterable&lt;[T1, T2, T3]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
404
-
405
- Returns an iterator that aggregates elements from each of the iterables. Used
406
- for lock-step iteration over several iterables at a time. When iterating over
407
- two iterables, use `izip2`. When iterating over three iterables, use `izip3`,
408
- etc. `izip` is an alias for `izip2`.
372
+ Returns an iterator that aggregates elements from each of the iterables. Used
373
+ for lock-step iteration over several iterables at a time. When iterating over
374
+ two iterables, use `izip2`. When iterating over three iterables, use `izip3`,
375
+ etc. `izip` is an alias for `izip2`.
409
376
 
377
+ <a name="izipLongest" href="izipLongest">#</a> <b>izipLongest</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, filler?: <i>D</i>): <i>Iterable&lt;[T1 | D, T2 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')<br />
378
+ <a name="izipLongest3" href="izipLongest3">#</a> <b>izipLongest3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>, filler?: <i>D</i>): <i>Iterable&lt;[T1 | D, T2 | D, T3 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
410
379
 
411
- <a name="izipLongest" href="izipLongest">#</a> <b>izipLongest</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, filler?: <i>D</i>): <i>Iterable&lt;[T1 | D, T2 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")<br />
412
- <a name="izipLongest3" href="izipLongest3">#</a> <b>izipLongest3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>, filler?: <i>D</i>): <i>Iterable&lt;[T1 | D, T2 | D, T3 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
413
-
414
- Returns an iterator that aggregates elements from each of the iterables. If the
380
+ Returns an iterator that aggregates elements from each of the iterables. If the
415
381
  iterables are of uneven length, missing values are filled-in with fillvalue.
416
382
  Iteration continues until the longest iterable is exhausted.
417
383
 
418
-
419
- <a name="izipMany" href="#izipMany">#</a> <b>izipMany</b>(...iters: <i>Array&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;Array&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
384
+ <a name="izipMany" href="#izipMany">#</a> <b>izipMany</b>(...iters: <i>Iterable&lt;T&gt;[]</i>): <i>Iterable&lt;T[]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
420
385
 
421
386
  Like the other izips (`izip`, `izip3`, etc), but generalized to take an
422
- unlimited amount of input iterables. Think `izip(*iterables)` in Python.
423
-
424
- **Note:** Due to Flow type system limitations, you can only "generially" zip
425
- iterables with homogeneous types, so you cannot mix types like `<A, B>` like
426
- you can with `izip`().
427
-
387
+ unlimited amount of input iterables. Think `izip(*iterables)` in Python.
428
388
 
429
- <a name="permutations" href="#permutations">#</a> <b>permutations</b>(iterable: <i>Iterable&lt;T&gt;</i>, r: number = undefined): <i>Iterable&lt;Array<T>&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
389
+ <a name="permutations" href="#permutations">#</a> <b>permutations</b>(iterable: <i>Iterable&lt;T&gt;</i>, r: number = undefined): <i>Iterable&lt;T[]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
430
390
 
431
391
  Return successive `r`-length permutations of elements in the iterable.
432
392
 
433
393
  If `r` is not specified, then `r` defaults to the length of the iterable and
434
394
  all possible full-length permutations are generated.
435
395
 
436
- Permutations are emitted in lexicographic sort order. So, if the input
396
+ Permutations are emitted in lexicographic sort order. So, if the input
437
397
  iterable is sorted, the permutation tuples will be produced in sorted order.
438
398
 
439
- Elements are treated as unique based on their position, not on their value. So
399
+ Elements are treated as unique based on their position, not on their value. So
440
400
  if the input elements are unique, there will be no repeat values in each
441
401
  permutation.
442
402
 
403
+ <a name="repeat" href="#repeat">#</a> <b>repeat</b>(thing: <i>T</i>, times: number = undefined): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
443
404
 
444
- <a name="repeat" href="#repeat">#</a> <b>repeat</b>(thing: <i>T</i>, times: number = undefined): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
445
-
446
- Returns an iterator that produces values over and over again. Runs
405
+ Returns an iterator that produces values over and over again. Runs
447
406
  indefinitely unless the times argument is specified.
448
407
 
449
-
450
- <a name="takewhile" href="#takewhile">#</a> <b>takewhile</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>T =&gt; bool</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
408
+ <a name="takewhile" href="#takewhile">#</a> <b>takewhile</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>(item: T) =&gt; boolean</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
451
409
 
452
410
  Returns an iterator that produces elements from the iterable as long as the
453
411
  predicate is true.
454
412
 
455
- <a name="zipLongest" href="zipLongest">#</a> <b>zipLongest</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, filler?: <i>D</i>): <i>Array&lt;[T1 | D, T2 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")<br />
456
- <a name="zipLongest3" href="zipLongest3">#</a> <b>zipLongest3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>, filler?: <i>D</i>): <i>Array&lt;[T1 | D, T2 | D, T3 | D]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
457
-
458
- Non-lazy version of [izipLongest](#izipLongest) and friends.
413
+ <a name="zipLongest" href="zipLongest">#</a> <b>zipLongest</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, filler?: <i>D</i>): <i>[T1 | D, T2 | D][]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')<br />
414
+ <a name="zipLongest3" href="zipLongest3">#</a> <b>zipLongest3</b>(xs: <i>Iterable&lt;T1&gt;</i>, ys: <i>Iterable&lt;T2&gt;</i>, zs: <i>Iterable&lt;T3&gt;</i>, filler?: <i>D</i>): <i>[T1 | D, T2 | D, T3 | D][]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
459
415
 
460
- <a name="zipMany" href="#zipMany">#</a> <b>zipMany</b>(...iters: <i>Array&lt;Iterable&lt;T&gt;&gt;</i>): <i>Array&lt;Array&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js "Source")
416
+ Eager version of [izipLongest](#izipLongest) and friends.
461
417
 
462
- Non-lazy version of [izipMany](#izipMany).
418
+ <a name="zipMany" href="#zipMany">#</a> <b>zipMany</b>(...iters: <i>Iterable&lt;T&gt;[]</i>): <i>T[][]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/itertools.js 'Source')
463
419
 
420
+ Eager version of [izipMany](#izipMany).
464
421
 
465
422
  ### Ports of more-itertools
466
423
 
467
- * [chunked](#chunked)
468
- * [flatten](#flatten)
469
- * [intersperse](#intersperse)
470
- * [itake](#itake)
471
- * [pairwise](#pairwise)
472
- * [partition](#partition)
473
- * [roundrobin](#roundrobin)
474
- * [heads](#heads)
475
- * [take](#take)
476
- * [uniqueEverseen](#uniqueEverseen)
477
- * [uniqueJustseen](#uniqueJustseen)
424
+ - [chunked](#chunked)
425
+ - [flatten](#flatten)
426
+ - [intersperse](#intersperse)
427
+ - [itake](#itake)
428
+ - [pairwise](#pairwise)
429
+ - [partition](#partition)
430
+ - [roundrobin](#roundrobin)
431
+ - [heads](#heads)
432
+ - [take](#take)
433
+ - [uniqueEverseen](#uniqueEverseen)
434
+ - [uniqueJustseen](#uniqueJustseen)
478
435
 
479
- <a name="chunked" href="#chunked">#</a> <b>chunked</b>(iterable: <i>Iterable&lt;T&gt;</i>, size: <i>number</i>): <i>Iterable&lt;Array&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
436
+ <a name="chunked" href="#chunked">#</a> <b>chunked</b>(iterable: <i>Iterable&lt;T&gt;</i>, size: <i>number</i>): <i>Iterable&lt;T[]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
480
437
 
481
438
  Break iterable into lists of length `size`:
482
439
 
@@ -489,43 +446,38 @@ list will be shorter:
489
446
  >>> [...chunked([1, 2, 3, 4, 5, 6, 7, 8], 3)]
490
447
  [[1, 2, 3], [4, 5, 6], [7, 8]]
491
448
 
492
-
493
- <a name="flatten" href="#flatten">#</a> <b>flatten</b>(iterableOfIterables: <i>Iterable&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
449
+ <a name="flatten" href="#flatten">#</a> <b>flatten</b>(iterableOfIterables: <i>Iterable&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
494
450
 
495
451
  Return an iterator flattening one level of nesting in a list of lists:
496
452
 
497
453
  >>> [...flatten([[0, 1], [2, 3]])]
498
454
  [0, 1, 2, 3]
499
455
 
500
-
501
- <a name="intersperse" href="#intersperse">#</a> <b>intersperse</b>(value: T, iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
456
+ <a name="intersperse" href="#intersperse">#</a> <b>intersperse</b>(value: T, iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
502
457
 
503
458
  Intersperse filler element `value` among the items in `iterable`.
504
459
 
505
460
  >>> [...intersperse(-1, range(1, 5))]
506
461
  [1, -1, 2, -1, 3, -1, 4]
507
462
 
508
-
509
- <a name="itake" href="#itake">#</a> <b>itake</b>(n: <i>number</i>, iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
463
+ <a name="itake" href="#itake">#</a> <b>itake</b>(n: <i>number</i>, iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
510
464
 
511
465
  Returns an iterable containing only the first `n` elements of the given
512
466
  iterable.
513
467
 
468
+ <a name="pairwise" href="#pairwise">#</a> <b>pairwise</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;[T, T]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
514
469
 
515
- <a name="pairwise" href="#pairwise">#</a> <b>pairwise</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;[T, T]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
516
-
517
- Returns an iterator of paired items, overlapping, from the original. When the
470
+ Returns an iterator of paired items, overlapping, from the original. When the
518
471
  input iterable has a finite number of items `n`, the outputted iterable will
519
472
  have `n - 1` items.
520
473
 
521
474
  >>> pairwise([8, 2, 0, 7])
522
475
  [(8, 2), (2, 0), (0, 7)]
523
476
 
477
+ <a name="partition" href="#partition">#</a> <b>partition</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>[T[], T[]]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
524
478
 
525
- <a name="partition" href="#partition">#</a> <b>partition</b>(iterable: <i>Iterable&lt;T&gt;</i>, predicate: <i>Predicate&lt;T&gt;</i>): <i>[Array&lt;T&gt;, Array&lt;T&gt;]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
526
-
527
- Returns a 2-tuple of arrays. Splits the elements in the input iterable into
528
- either of the two arrays. Will fully exhaust the input iterable. The first
479
+ Returns a 2-tuple of arrays. Splits the elements in the input iterable into
480
+ either of the two arrays. Will fully exhaust the input iterable. The first
529
481
  array contains all items that match the predicate, the second the rest:
530
482
 
531
483
  >>> const isOdd = x => x % 2 !== 0;
@@ -536,8 +488,7 @@ array contains all items that match the predicate, the second the rest:
536
488
  >>> evens
537
489
  [0, 2, 4, 6, 8]
538
490
 
539
-
540
- <a name="roundrobin" href="#roundrobin">#</a> <b>roundrobin</b>(...iterables: <i>Array&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
491
+ <a name="roundrobin" href="#roundrobin">#</a> <b>roundrobin</b>(...iterables: <i>Iterable&lt;T&gt;[]</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
541
492
 
542
493
  Yields the next item from each iterable in turn, alternating between them.
543
494
  Continues until all items are exhausted.
@@ -545,21 +496,18 @@ Continues until all items are exhausted.
545
496
  >>> [...roundrobin([1, 2, 3], [4], [5, 6, 7, 8])]
546
497
  [1, 4, 5, 2, 6, 3, 7, 8]
547
498
 
548
-
549
- <a name="heads" href="#heads">#</a> <b>heads</b>(...iterables: <i>Array&lt;Iterable&lt;T&gt;&gt;</i>): <i>Iterable&lt;Array&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
499
+ <a name="heads" href="#heads">#</a> <b>heads</b>(...iterables: <i>Iterable&lt;T&gt;[]</i>): <i>Iterable&lt;T[]&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
550
500
 
551
501
  Like `roundrobin()`, but will group the output per "round".
552
502
 
553
503
  >>> [...heads([1, 2, 3], [4], [5, 6, 7, 8])]
554
504
  [[1, 4, 5], [2, 6], [3, 7], [8]]
555
505
 
506
+ <a name="take" href="#take">#</a> <b>take</b>(n: <i>number</i>, iterable: <i>Iterable&lt;T&gt;</i>): <i>T[]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
556
507
 
557
- <a name="take" href="#take">#</a> <b>take</b>(n: <i>number</i>, iterable: <i>Iterable&lt;T&gt;</i>): <i>Array&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
558
-
559
- Non-lazy version of [itake](#itake).
508
+ Eager version of [itake](#itake).
560
509
 
561
-
562
- <a name="uniqueEverseen" href="#uniqueEverseen">#</a> <b>uniqueEverseen</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>T =&gt; Primitive</i></i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
510
+ <a name="uniqueEverseen" href="#uniqueEverseen">#</a> <b>uniqueEverseen</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>(item: T) =&gt; Primitive</i></i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
563
511
 
564
512
  Yield unique elements, preserving order.
565
513
 
@@ -568,8 +516,7 @@ Yield unique elements, preserving order.
568
516
  >>> [...uniqueEverseen('AbBCcAB', s => s.toLowerCase())]
569
517
  ['A', 'b', 'C']
570
518
 
571
-
572
- <a name="uniqueJustseen" href="#uniqueJustseen">#</a> <b>uniqueJustseen</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>T =&gt; Primitive</i></i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js "Source")
519
+ <a name="uniqueJustseen" href="#uniqueJustseen">#</a> <b>uniqueJustseen</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>(item: T) =&gt; Primitive</i></i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/more-itertools.js 'Source')
573
520
 
574
521
  Yields elements in order, ignoring serial duplicates.
575
522
 
@@ -578,53 +525,46 @@ Yields elements in order, ignoring serial duplicates.
578
525
  >>> [...uniqueJustseen('AbBCcAB', s => s.toLowerCase())]
579
526
  ['A', 'b', 'C', 'A', 'B']
580
527
 
581
-
582
528
  ### Additions
583
529
 
584
- * [compact](#compact)
585
- * [compactObject](#compactObject)
586
- * [find](#find)
587
- * [first](#first)
588
- * [flatmap](#flatmap)
589
- * [icompact](#icompact)
590
-
591
- <a name="compact" href="#compact">#</a> <b>compact</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Array&lt;$NonMaybeType&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
592
-
593
- Non-lazy version of [icompact](#icompact).
530
+ - [compact](#compact)
531
+ - [compactObject](#compactObject)
532
+ - [find](#find)
533
+ - [first](#first)
534
+ - [flatmap](#flatmap)
535
+ - [icompact](#icompact)
594
536
 
537
+ <a name="compact" href="#compact">#</a> <b>compact</b>(iterable: <i>Iterable&lt;T | null | undefined&gt;</i>): <i>T[]</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
595
538
 
596
- <a name="compactObject" href="#compactObject">#</a> <b>compactObject</b><i>&lt;O: { [key: string]: * }&gt;</i>(obj: <i>O</i>): <i>$ObjMap&lt;O, &lt;T&gt;(T) =&gt; $NonMaybeType&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
539
+ Eager version of [icompact](#icompact).
597
540
 
598
- > **NOTE:** 🙀 OMG, that type signature! **Don't panic.** Just look at the example :)
541
+ <a name="compactObject" href="#compactObject">#</a> <b>compactObject</b>(obj: <i>Record&lt;K, V | null | undefined&gt;</i>): <i>Record&lt;K, V&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
599
542
 
600
- Removes all undefined values from the given object. Returns a new object.
543
+ Removes all "nullish" values from the given object. Returns a new object.
601
544
 
602
545
  >>> compactObject({ a: 1, b: undefined, c: 0, d: null })
603
546
  { a: 1, c: 0, d: null }
604
547
 
605
-
606
- <a name="find" href="#find">#</a> <b>find</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>Maybe&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
548
+ <a name="find" href="#find">#</a> <b>find</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>T | undefined</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
607
549
 
608
550
  Returns the first item in the iterable for which the predicate holds, if any.
609
- If no such item exists, `undefined` is returned. The default predicate is any
610
- defined value.
611
-
551
+ If no such item exists, `undefined` is returned. If no default predicate is
552
+ given, the first value from the iterable is returned.
612
553
 
613
- <a name="first" href="#first">#</a> <b>first</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>Maybe&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
554
+ <a name="first" href="#first">#</a> <b>first</b>(iterable: <i>Iterable&lt;T&gt;</i>, keyFn?: <i>Predicate&lt;T&gt;</i>): <i>T | undefined</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
614
555
 
615
556
  Almost the same as `find()`, except when no explicit predicate function is
616
557
  given. `find()` will always return the first value in the iterable, whereas
617
- `first()` will return the first non-undefined value in the iterable.
558
+ `first()` will return the first non-`undefined` value in the iterable.
618
559
 
619
560
  Prefer using `find()`, as its behavior is more intuitive and predictable.
620
561
 
562
+ <a name="flatmap" href="#flatmap">#</a> <b>flatmap</b>(iterable: <i>Iterable&lt;T&gt;</i>, mapper: <i>(item: T) =&gt; Iterable&lt;S&gt;</i>): <i>Iterable&lt;S&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
621
563
 
622
- <a name="flatmap" href="#flatmap">#</a> <b>flatmap</b>(iterable: <i>Iterable&lt;T&gt;</i>, mapper: <i>T =&gt; Iterable&lt;S&gt;</i>): <i>Iterable&lt;S&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
623
-
624
- Returns 0 or more values for every value in the given iterable. Technically,
564
+ Returns 0 or more values for every value in the given iterable. Technically,
625
565
  it's just calling map(), followed by flatten(), but it's a very useful
626
566
  operation if you want to map over a structure, but not have a 1:1 input-output
627
- mapping. Instead, if you want to potentially return 0 or more values per input
567
+ mapping. Instead, if you want to potentially return 0 or more values per input
628
568
  element, use flatmap():
629
569
 
630
570
  For example, to return all numbers `n` in the input iterable `n` times:
@@ -633,13 +573,10 @@ For example, to return all numbers `n` in the input iterable `n` times:
633
573
  >>> [...flatmap([0, 1, 2, 3, 4], repeatN)]
634
574
  [1, 2, 2, 3, 3, 3, 4, 4, 4, 4] // note: no 0
635
575
 
576
+ <a name="icompact" href="#icompact">#</a> <b>icompact</b>(iterable: <i>Iterable&lt;T | null | undefined&gt;</i>): <i>Iterable&lt;T&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js 'Source')
636
577
 
637
- <a name="icompact" href="#icompact">#</a> <b>icompact</b>(iterable: <i>Iterable&lt;T&gt;</i>): <i>Iterable&lt;$NonMaybeType&lt;T&gt;&gt;</i> [&lt;&gt;](https://github.com/nvie/itertools.js/blob/master/src/custom.js "Source")
638
-
639
- Returns an iterable, filtering out any `undefined` values from the input
640
- iterable. This function is useful to convert a list of `Maybe<T>`'s to a list
641
- of `T`'s, discarding all the undefined values:
578
+ Returns an iterable, filtering out any "nullish" values from the input
579
+ iterable.
642
580
 
643
581
  >>> compact([1, 2, undefined, 3])
644
582
  [1, 2, 3]
645
-