
© xkcd.com
Python's iterable and iterator library for JavaScript. Parent is js-library.
⚠️ Depending on your environment, the code may requireregeneratorRuntimeto be defined, for instance by importing regenerator-runtime/runtime.
import {cycle} from '@iterable-iterator/cycle';
import {chain} from '@iterable-iterator/chain';
cycle( chain( [ 0 , 1 , 2 ] , [ 3 , 4 , 5 ] ) ) ; // 0 1 2 3 4 5 0 1 ...The goal of this project is to make (the parts that interest me of)
the following python constructs/idioms/libraries available in JavaScript under the
.
iter,next,StopIteration,list,sorted,map,zip,filter,sum,any,all,min,max- itertools
- itertools recipes
- more-itertools
- cardinality
reduce
The corresponding software library used to be released as a monolith. It has since been split up into multiple packages.
The packages are released under multiple npm @scopes.
Extra features are marked with a *.
@iterable-iterator/cardinality:isEmpty,count, ...@iterable-iterator/chain:chain,chain.from_iterableas_chain@iterable-iterator/consume:consume(it, n)asconsume,consume(it)asexhaust@iterable-iterator/convolution:convolveasconvolution,_convolution*@iterable-iterator/count:count@iterable-iterator/cycle:cycle,ncyclesasncycle@iterable-iterator/filter:filter,filtertrue,filterfalse,compress@iterable-iterator/group:group,groupby,by*@iterable-iterator/iter:iter@iterable-iterator/list:list@iterable-iterator/map:map(:warning: unary only),starmap,pick@iterable-iterator/next:next,StopIteration,_next*@iterable-iterator/range:range@iterable-iterator/reduce:reduce,sum,any,all,some,min,max@iterable-iterator/repeat:repeat,nrepeat@iterable-iterator/reversed:reversed@iterable-iterator/round-robin:roundRobin@iterable-iterator/select:first,last,nth*(:sparkles: supports negative indices)@iterable-iterator/slice:take(also aliased tohead),drop,trunc,tail,takewhile,dropwhile,isliceasslice@iterable-iterator/sorted:sorted@iterable-iterator/tee:tee@iterable-iterator/window:window*@iterable-iterator/zip:zip,zip_longestasziplongest,enumerate
@combinatorics/n-combinations:combinations,_combinations*@combinatorics/n-multicombinations:combinations_with_replacementasmulticombinations,_multicombinations*@combinatorics/n-permutations:permutations,_permutations*
@set-theory/cartesian-product:product,diagonal*@set-theory/closure:closure*