All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Methods
findBest
,asyncFindBest
findBestOr
,asyncFindBestOr
firstHighest
lastHighest
firstLowest
lastLowest
Methods
distinct
- A
Forkerator
can now be used as an iterable.
Methods
isString
,notString
isArray
,notArray
Methods
forkerate
,asyncForkerate
require('iter-tools')
in node 12+ (ERR_REQUIRE_ESM
)
Folders
es2015
: It is expected that most users will switch toimport ... from 'iter-tools-es'
.
Methods
joinAsString
,asyncJoinAsString
(Instead usestr(join(...))
)joinAsStringWith
,asyncJoinAsStringWith
(Instead usestr(joinWith(sep, ...))
)regexpExec
nullOr
,nullOrAsync
(Instead usepeekerate
)asyncFlatMapParallel
asyncMapParallel
(Instead useasyncBuffer(n, asyncMap(fn, iterable))
)asyncFilterParallel
(Instead useasyncBuffer(n, asyncFilter(fn, iterable))
)group
,asyncGroup
(splitGroups
is a drop-in replacement)combinations
,combinationsWithReplacement
,permutations
,product
(use@iter-tools/combinatorics
)leadingWindow
,asyncLeadingWindow
(Instead usewindowAhead
. Only arg order changed)trailingWindow
,asyncTrailingWindow
(Instead usewindowBehind
. Only arg order changed)
Arguments
n
fromfork
andasyncFork
. Use destructuring or callreturn()
on the forks iterable.
Exports
InterleaveBuffer
,AsyncInterleaveBuffer
Overloads
{ size, filler }
fromleadingWindow
,asyncLeadingWindow
,trailingWindow
,asyncTrailingWindow
. Instead use e.g.leadingWindow(size, { filler })
.splitGroups(null)
,asyncSplitGroups(null)
. (UsesplitGroups(iterable)
)
Folders
es2018
moved to separate package:iter-tools-es
.- e.g.
import { map } from 'iter-tools/es2018
is nowimport { map } from 'iter-tools-es
- e.g.
Methods
last
,asyncLast
totakeLast
,asyncTakeLast
lastOr
,asyncLastOr
totakeLastOr
,asyncTakeLastOr
groupBy
,asyncGroupBy
tosplitGroups
,asyncSplitGroups
splitAt
,asyncSplitAt
tobisect
,asyncBisect
splitWith
,asyncSplitWith
tosplitWhen
,asyncSplitWhen
*subseq
to*seq
startsWithSubseq
,asyncStartsWithSubseq
tostartsWithSeq
,asyncStartsWithSeq
startsWithAnySubseq
,asyncStartsWithAnySubseq
tostartsWithAnySeq
,asyncStartsWithAnySeq
includesSubseq
,asyncIncludesSubseq
toincludesSeq
,asyncIncludesSeq
includesAnySubseq
,asyncIncludesAnySubseq
toincludesAnySeq
,asyncIncludesAnySeq
splitOnSubseq
,asyncSplitOnSubseq
tosplitOnSeq
,asyncSplitOnSeq
splitOnAnySubseq
,asyncSplitOnAnySubseq
tosplitOnAnySeq
,asyncSplitOnAnySeq
joinWithSubseq
,asyncJoinWithSubseq
tojoinWithSeq
,asyncJoinWithSeq
interleave
andasyncInterleave
now wrap sources withPeekerator
instead ofInterleaveBuffer
. Changefunction* (canTakeAny, ...buffers) { while(canTakeAny()) { ... } }
tofunction* (all, ...peekrs) { while(!all.done) { ... } }
.last
andlastOr
no longer have O(1) optimizations for array inputs. Instead usearrayLast
orarrayLastOr
.batch
,asyncBatch
now yield batches which are iterables but not arrays. The batches must be consumed in order. For the old behavior usemap(toArray, batch(...))
.*any
and*anySubseq
methods now require the possible values or subseqs to be passed as a non-nullable array. To replicate the old behavior changestartsWithAny(valuesIterable)
tostartsWithAny(wrap([...valuesIterable])
.includesAny
,startsWithAny
(and async and seq variants) now returnfalse
when nothing is being searched for, e.g.includesAny([], iterable) === false
.windowAhead
Methods
arrayFirst
,arrayFirstOr
arrayLast
,arrayLastOr
arrayReverse
interposeSeq
,asyncInterposeSeq
peekerate
,asyncPeekerate
spliterate
,asyncSpliterate
spliterateGrouped
,asyncSpliterateGrouped
window
,asyncWindow
stringFrom
,stringFromAsync
isNull
,notNull
isUndefined
,notUndefined
isNil
,notNil
isObject
,notObject
isIterable
,notIterable
,isAsyncIterable
,notAsyncIterable
isWrappable
,notWrappable
,isAsyncWrappable
,notAsyncWrappable
isLoopable
,notLoopable
,isAsyncLoopable
,notAsyncLoopable
deepEqual
,asyncDeepEqual
windowAhead
,windowBehind
,asyncWindowAhead
,asyncWindowBehind
Overloads
bisect(predicate)
,asyncBisect(predicate)
Aliases
str
forstringFrom
,asyncStr
forstringFromAsync
Arguments
useFiller
option forleadingWindow
andasyncLeadingWindow
.proto
passed toObject.create
forobjectFrom
andobjectFromAsync
(alsotoObject
andasyncToObject
).same
toequal
,includes
,includesAny
,includesSeq
,includesAnySeq
,startsWith
,startsWithAny
,startsWithSeq
,startsWithAnySeq
,splitOn
,splitOnAny
,splitOnSeq
,splitOnAnySeq
(and async variants:asyncEqual
,asyncIncludes
,asyncIncludesAny
,asyncIncludesSeq
,asyncIncludesAnySeq
,asyncStartsWith
,asyncStartsWithAny
,asyncStartsWithSeq
,asyncStartsWithAnySeq
,asyncSplitOn
,asyncSplitOnAny
,asyncSplitOnSeq
,asyncSplitOnAnySeq
)
Instance Methods
- Peekerator:
asIterator
method
- Removed O(1) array optimizations from
last
andlastOr
- Factorial no attempts to use BigNum internally. Some inputs may now cause
combinations().size
orcombinationsWithReplacement().size
to overflow during computation.
Instance Methods
- Peekerator:
advance
andreturn
methods now returnthis
(wasundefined
).
Methods
iter
,asyncIter
iterable
,asyncIterable
tee
,asyncTee
execute
,asyncExecute
(Instead usemap(_ => callback(), range())
(orasyncMap(...)
))merge
,asyncMerge
(Instead usecollate
,roundRobin
,interleave
(or async equivalents))splitLines
,asyncSplitLines
(Instead useasyncMap(asyncJoinAsString, asyncSplitOnAnySubseq(['\r\n', '\n'], asyncFlat(fileChunks)))
orsplitOnAnySubseq(['\r\n', 'n'], fileString)
. Sorry, a better way is coming soon!)regexpSplit
(Instead usesplitWith(regexp, str)
)cursor
,asyncCursor
(Instead useleadingWindow
ortrailingWindow
(or async equivalents))keys
(Instead useobjectKeys(obj)
orwrapKeys({ keys(); }))
)values
(Instead useobjectValues(obj)
orwrapValues({ values(); }))
)entries
(Instead useobjectEntries(obj)
orwrapEntries({ entries(); }))
)
Overloads
size({ size })
andsize(array)
(Instead usegetSize
)cycle(times, iterable)
,asyncCycle(times, iterable)
andrepeat(times, value)
(Instead usecycleTimes(n, iterable)
(orasyncCycleTimes
), andrepeatTimes(n, iterable)
)consume(callback, iterable)
,asyncConsume(callback, iterable)
(Instead useforEach
)
Aliases
count
was an alias forrange
chain
,asyncChain
were aliases forconcat
,asyncConcat
zipLongest
,asyncZipLongest
were aliases forzipAll
,asyncZipAll
Arguments
concurrency
fromasyncMap
,asyncFilter
.- Extra arguments from
compose
,pipe
,pipeExec
. Previously all initial arguments were given to the outermost composed function.
Helper methods
mergeByComparison
,mergeByChance
,mergeByPosition
,asyncMergeByComparison
,asyncMergeByChance
,asyncMergeByPosition
Methods
pipe
toexecPipe
import 'iter-tools/es5/method'
should now beimport 'iter-tools/method'
.- IMPORTANT; BREAKING:
slice(n)
is now equivalent to[].slice(n)
, not[].slice(0, n)
. You should now writeslice(0, n, iterable)
. - IMPORTANT; BREAKING:
repeat
order of arguments changed. You must now writerepeat(3, 'x')
instead ofrepeat(x, 3)
. - All functions return iterables that can consumed multiple times.
- It is now an error to make an empty partial application, e.g.
map()
. size(iterable)
now always consumesiterable
. UsegetSize
if you know this is unnecessary.takeSorted
andasyncTakeSorted
: Bothn
andcomparator
arguments are now optional.enumerate
andasyncEnumerate
: optional starting idx is now specified before iterable.- Optional configuration arguments can no longer be undefined. This was at odds with considering undefined as a valid iterable.
range
can now called as eitherrange(end)
orrange(start, end, step)
. This matches Python.zipAll
now takes optionalfiller
argument to use in place of values from exhausted iterables.fork
andasyncFork
now take an extra optional argument: the number of forks.permutations
,combinations
,combinationsWithReplacement
: order of arguments is changed. Can now be curried.permutations
,combinations
,combinationsWithReplacement
, andproduct
:getSize()
is now justsize
.groupBy()
andasyncGroupBy(null)
now return a partial application instead of an iterable.groupBy
now throws an error if the groups are accessed out of order.asyncBuffer
now starts buffering immediately instead of when the first item is taken.- For most Typescript generic method types, the order of the generics has changed. (Note: this only matters if you are explicitly providing values for the generics.)
Methods
pipe
collate
,asyncCollate
roundRobin
,asyncRoundRobin
call
,apply
wrap
,asyncWrap
wrapKeys
wrapValues
wrapEntries
objectKeys
objectValues
objectEntries
toObject
,asyncToObject
findOr
,asyncFindOr
firstOr
,asyncFirstOr
last
,asyncLast
lastOr
,asyncLastOr
take
,asyncTake
drop
,asyncDrop
when
isEmpty
,asyncIsEmpty
asyncMapParallel
,asyncFilterParallel
,asyncFlatMapParallel
interleave
,asyncInterleave
,asyncInterleaveReady
equal
,asyncEqual
includes
,includesAny
,includesSubseq
,includesAnySubseq
,asyncIncludes
,asyncIncludesAny
,asyncIncludesSubseq
,asyncIncludesAnySubseq
startsWith
,startsWithAny
,startsWithSubseq
,startsWithAnySubseq
,asyncStartsWith
,asyncStartsWithAny
,asyncStartsWithSubseq
,asyncStartsWithAnySubseq
splitOn
,splitOnAny
,splitOnSubseq
,splitOnAnySubseq
,asyncSplitOn
,asyncSplitOnAny
,asyncSplitOnSubseq
,asyncSplitOnAnySubseq
split
,asyncSplit
splitWith
,asyncSplitWith
splitAt
,asyncSplitAt
join
,asyncJoin
joinWith
,joinWithSubseq
,asyncJoinWith
,asyncJoinWithSubseq
joinAsString
,joinAsStringWith
,asyncJoinAsString
,asyncJoinAsStringWith
group
,asyncGroup
explode
,asyncExplode
reverse
,asyncReverse
leadingWindow
,asyncLeadingWindow
trailingWindow
,asyncTrailingWindow
cycleTimes
,asyncCycleTimes
repeatTimes
getSize
Aliases
arrayFrom
,arrayFromAsync
as aliases fortoArray
,asyncToArray
objectFrom
,objectFromAsync
as aliases fortoObject
,asyncToObject
Arguments
- [optional]
n
(count) forfork
andasyncFork
- [optional]
n
(count) forcycle
andasyncCycle
- [optional]
filler
(specified as{ filler }
) forzip
andzipAll
- [optional]
notFoundValue
forfind
andasyncFind
Overloads
range(start, end, [step])
(Matches Python.)
Overloads
groupBy(null, source)
andasyncGroupBy(null, source)
. Instead usegroup(source)
andasyncGroup(source)
.consume(callback, source)
andasyncConsume(callback, source)
. Instead useforEach(callback, source)
andasyncForEach(callback, source)
.
- A wide variety of Typescript type bugs were identified and squashed. You can see the full list on Github
Methods
flat
,asyncFlat
cursor
,asyncCursor
merge
,asyncMerge
pipe
partition
,asyncPartition
Helper methods
mergeByComparison
,mergeByChance
,mergeByPosition
,asyncMergeByComparison
,asyncMergeByChance
,asyncMergeByPosition
Arguments
- [optional]
concurrency
forasyncMap
,asyncFilter
- async function can take an async callback
find
andasyncFind
: now return undefined when an item has not been found
- combinatory function generators return an iterable with an extra method to calculate the size
- Added polyfills to transpiled versions
- Bump all deps (code vulnerability)
- Removed clone-regexp dependency
- Typescript definitions
- Typescript definitions
Methods
asyncMapBatch
Arguments
filler
argument fromzipLongest
,asyncZipLongest
- All methods: Object parameters are no longer implicitly treated as iterables, and will throw errors.
- All curried methods: passing
null
andundefined
as the iterable will always result in those values being coerced to iterables. Currying happens based onarguments.length
. compose([...fns])
=>compose(...fns)
asyncRegexpExecIter
andasyncRegexpSplitIter
now coerce sync iterables to async iterables, matching behavior of all other async methods.regexpExec
now ensures its RegExp parameter is global unless it is already sticky.slice
andasyncSlice
now support negativestart
andend
.
iter
,asyncIter
Methods
iterable
,asyncIterable
(NOTE: These methods are NOT the same asiter
andasyncIter
. What they do is exactly the opposite!)some
,asyncSome
every
,asyncEvery
tap
,asyncTap
first
,asyncFirst
,takeSorted
,asyncTakeSorted
toArray
,asyncToArray
asyncBuffer
Aliases
concat
andasyncConcat
forchain
andasyncChain
zipAll
andasyncZipAll
forzipLongest
andasyncZipLongest
Arguments
- [optional]
initial
forreduce
andasyncReduce
. If no initial value is specified, the first item will be used.
Methods
keys
,values
,entries
size
find
- The behavior of
iter(iter(iterable))
should now be considered undefined. asyncZip
andasyncZipLongest
now run items in parallel
iter({next: 'foo'})
now returnsIterator[[next, 'foo']]
not{next: 'foo'}
. This is particular to objects having any property named next.
Methods
consume
,asyncConsume
batch
,asyncBatch
,asyncMapBatch
regexpExecIter
,asyncRegexpExecIter
asyncThrottle
- Changed the whole way the library is imported. Very breaking.