|
1 |
| -# :hammer_and_wrench: [@aureooms/js-itertools](https://make-github-pseudonymous-again.github.io/js-itertools) |
| 1 | +:hammer_and_wrench: |
| 2 | +[js-itertools](https://make-github-pseudonymous-again.github.io/js-itertools) |
| 3 | +[](https://raw.githubusercontent.com/make-github-pseudonymous-again/js-itertools/main/LICENSE) |
| 4 | +== |
2 | 5 |
|
3 | 6 | <p align="center">
|
4 | 7 | <a href="https://xkcd.com/353">
|
|
8 | 11 | </p>
|
9 | 12 |
|
10 | 13 | Python's iterable and iterator library for JavaScript.
|
11 |
| -See [docs](https://make-github-pseudonymous-again.github.io/js-itertools). |
12 |
| -Parent is [@aureooms/js-library](https://github.com/make-github-pseudonymous-again/js-library). |
| 14 | +Parent is [js-library](https://github.com/make-github-pseudonymous-again/js-library). |
13 | 15 |
|
14 |
| -> :warning: The code requires `regeneratorRuntime` to be defined, for instance by importing |
| 16 | +> :warning: Depending on your environment, the code may require |
| 17 | +> `regeneratorRuntime` to be defined, for instance by importing |
15 | 18 | > [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
|
16 | 19 |
|
17 | 20 | ```js
|
18 |
| -cycle( chain( [ [ 0 , 1 , 2 ] , [ 3 , 4 , 5 ] ] ) ) ; // 0 1 2 3 4 5 0 1 ... |
| 21 | +import {cycle} from '@iterable-iterator/cycle'; |
| 22 | +import {chain} from '@iterable-iterator/chain'; |
| 23 | +cycle( chain( [ 0 , 1 , 2 ] , [ 3 , 4 , 5 ] ) ) ; // 0 1 2 3 4 5 0 1 ... |
19 | 24 | ```
|
20 | 25 |
|
| 26 | +## :newspaper: Description |
| 27 | + |
| 28 | +The goal of this project is to make (the parts that interest me of) |
| 29 | +the following python constructs/idioms/libraries available in JavaScript under the |
21 | 30 | [](https://raw.githubusercontent.com/make-github-pseudonymous-again/js-itertools/main/LICENSE)
|
22 |
| -[](https://www.npmjs.org/package/@aureooms/js-itertools) |
23 |
| -[](https://github.com/make-github-pseudonymous-again/js-itertools/actions/workflows/ci:test.yml?query=branch:main) |
24 |
| -[](https://david-dm.org/make-github-pseudonymous-again/js-itertools) |
25 |
| -[](https://david-dm.org/make-github-pseudonymous-again/js-itertools?type=dev) |
26 |
| -[](https://github.com/make-github-pseudonymous-again/js-itertools/issues) |
27 |
| -[](https://www.npmjs.org/package/@aureooms/js-itertools) |
28 |
| - |
29 |
| -[](https://codeclimate.com/github/make-github-pseudonymous-again/js-itertools/issues) |
30 |
| -[](https://codeclimate.com/github/make-github-pseudonymous-again/js-itertools/trends/churn) |
31 |
| -[](https://codecov.io/gh/make-github-pseudonymous-again/js-itertools) |
32 |
| -[](https://codeclimate.com/github/make-github-pseudonymous-again/js-itertools/trends/technical_debt) |
33 |
| -[](https://make-github-pseudonymous-again.github.io/js-itertools/source.html) |
34 |
| -[](https://bundlephobia.com/result?p=@aureooms/js-itertools) |
35 |
| - |
36 |
| -## :link: References in Python and JavaScript |
37 |
| - |
38 |
| - - https://docs.python.org/3/library/itertools.html |
| 31 | + - `iter`, `next`, `StopIteration`, `list`, `sorted`, `map`, `zip`, `filter`, `sum`, `any`, `all`, `min`, `max` |
| 32 | + - [itertools](https://docs.python.org/3/library/itertools.html) |
| 33 | + - [itertools recipes](https://docs.python.org/3/library/itertools.html#itertools-recipes) |
| 34 | + - [more-itertools](https://pypi.org/project/more-itertools) |
| 35 | + - [`reduce`](https://docs.python.org/3/library/functools.html?highlight=reduce#functools.reduce) |
| 36 | + |
| 37 | +The corresponding software library used to be released as a monolith. |
| 38 | +It has since been split up into multiple packages. |
| 39 | + |
| 40 | +## :deciduous_tree: Hierarchy |
| 41 | + |
| 42 | +The packages are released under multiple npm @scopes. |
| 43 | +Extra features are marked with a `*`. |
| 44 | + |
| 45 | +### [`@iterable-iterator`](https://github.com/iterable-iterator) |
| 46 | + |
| 47 | + - [`@iterable-iterator/chain`](https://github.com/iterable-iterator/chain): |
| 48 | + `chain`, `chain.from_iterable` as `_chain` |
| 49 | + - [`@iterable-iterator/consume`](https://github.com/iterable-iterator/consume): |
| 50 | + `consume(it, n)` as `consume`, `consume(it)` as `exhaust` |
| 51 | + - [`@iterable-iterator/convolution`](https://github.com/iterable-iterator/convolution): |
| 52 | + `convolve` as `convolution`, `_convolution*` |
| 53 | + - [`@iterable-iterator/count`](https://github.com/iterable-iterator/count): |
| 54 | + `count` |
| 55 | + - [`@iterable-iterator/cycle`](https://github.com/iterable-iterator/cycle): |
| 56 | + `cycle`, `ncycles` as `ncycle` |
| 57 | + - [`@iterable-iterator/filter`](https://github.com/iterable-iterator/filter): |
| 58 | + `filter`, `filtertrue`, `filterfalse`, `compress` |
| 59 | + - [`@iterable-iterator/group`](https://github.com/iterable-iterator/group): |
| 60 | + `group`, `groupby`, `by*` |
| 61 | + - [`@iterable-iterator/iter`](https://github.com/iterable-iterator/iter): |
| 62 | + `iter` |
| 63 | + - [`@iterable-iterator/list`](https://github.com/iterable-iterator/list): |
| 64 | + `list` |
| 65 | + - [`@iterable-iterator/map`](https://github.com/iterable-iterator/map): |
| 66 | + `map` (:warning: unary only), `starmap`, `pick` |
| 67 | + - [`@iterable-iterator/next`](https://github.com/iterable-iterator/next): |
| 68 | + `next`, `StopIteration`, `_next*` |
| 69 | + - [`@iterable-iterator/range`](https://github.com/iterable-iterator/range): |
| 70 | + `range` |
| 71 | + - [`@iterable-iterator/reduce`](https://github.com/iterable-iterator/reduce): |
| 72 | + `reduce`, `sum`, `any`, `all`, `some`, `min`, `max` |
| 73 | + - [`@iterable-iterator/repeat`](https://github.com/iterable-iterator/repeat): |
| 74 | + `repeat`, `nrepeat` |
| 75 | + - [`@iterable-iterator/reversed`](https://github.com/iterable-iterator/reversed): |
| 76 | + `reversed` |
| 77 | + - [`@iterable-iterator/round-robin`](https://github.com/iterable-iterator/round-robin): |
| 78 | + `roundRobin` |
| 79 | + - [`@iterable-iterator/select`](https://github.com/iterable-iterator/select): |
| 80 | + `first`, `last`, `nth*` (:sparkles: supports negative indices) |
| 81 | + - [`@iterable-iterator/slice`](https://github.com/iterable-iterator/slice): |
| 82 | + `take` (also aliased to `head`), `drop`, `trunc`, `tail`, `takewhile`, `dropwhile`, `islice` as `slice` |
| 83 | + - [`@iterable-iterator/sorted`](https://github.com/iterable-iterator/sorted): |
| 84 | + `sorted` |
| 85 | + - [`@iterable-iterator/tee`](https://github.com/iterable-iterator/tee): |
| 86 | + `tee` |
| 87 | + - [`@iterable-iterator/window`](https://github.com/iterable-iterator/window): |
| 88 | + `window*` |
| 89 | + - [`@iterable-iterator/zip`](https://github.com/iterable-iterator/zip): |
| 90 | + `zip`, `zip_longest` as `ziplongest`, `enumerate` |
| 91 | + |
| 92 | +### [`@combinatorics`](https://github.com/computational-combinatorics) |
| 93 | + - [`@combinatorics/n-combinations`](https://github.com/computational-combinatorics/n-combinations): `combinations`, `_combinations*` |
| 94 | + - [`@combinatorics/n-multicombinations`](https://github.com/computational-combinatorics/n-multicombinations): `combinations_with_replacement` as `multicombinations`, `_multicombinations*` |
| 95 | + - [`@combinatorics/n-permutations`](https://github.com/computational-combinatorics/n-permutations): `permutations`, `_permutations*` |
| 96 | + |
| 97 | +### [`@set-theory`](https://github.com/set-theory) |
| 98 | + |
| 99 | + - [`@set-theory/cartesian-product`](https://github.com/set-theory/cartesian-product): `product`, `diagonal*` |
| 100 | + - [`@set-theory/closure`](https://github.com/set-theory/closure): `closure*` |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +## :link: More references in Python and JavaScript |
| 105 | + |
39 | 106 | - http://mochi.github.io/mochikit/doc/html/MochiKit/Iter.html
|
40 | 107 | - https://github.com/cweider/js-itertools
|
41 | 108 | - http://itertoolsjs.com
|
42 | 109 | - https://github.com/thegoleffect/node-itertools
|
43 | 110 | - http://rfw.name/sloth.js
|
44 | 111 | - https://github.com/lodash/lodash
|
45 |
| - - https://github.com/erikrose/more-itertools |
46 | 112 | - https://github.com/StreetStrider/aux.js
|
0 commit comments