Skip to content

Commit

Permalink
♻️ refactor: Use new @iterable-iterator packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Apr 27, 2021
1 parent 35ebc9a commit 38b5046
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ See [docs](https://set-theory.github.io/cartesian-product/index.html).
import { product } from '@set-theory/cartesian-product' ;
product( [ "ABCD" , "xy" ] , 1 ) ; // Ax Ay Bx By Cx Cy Dx Dy

import { range } from '@aureooms/js-itertools' ;
import { range } from '@iterable-iterator/range' ;
product( [ range( 2 ) ] , 3 ) ; // 000 001 010 011 100 101 110 111

product( [ range( 4 ) , range( 4 ) ] ) ; // 00 01 02 03 10 11 12 13 20 21 ...

import { diagonal } from '@set-theory/cartesian-product' ;
diagonal( range( 4 ) , range( 4 ) ) ; // 00 01 10 02 11 20 03 12 21 30 ...

import { count } from '@aureooms/js-itertools' ;
import { count } from '@iterable-iterator/count' ;
product( [count( ), count( )] ) ; // Loops forever without yielding. DO NOT DO THIS
diagonal( count( ), count( ) ) ; // 00 01 10 02 11 20 03 12 21 30 ...
import { _product } from '@set-theory/cartesian-product' ;
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,22 @@
},
"dependencies": {
"@aureooms/js-collections-deque": "^7.0.0",
"@aureooms/js-itertools": "^5.1.1"
"@iterable-iterator/count": "^0.0.1",
"@iterable-iterator/cycle": "^0.0.1",
"@iterable-iterator/iter": "^0.0.2",
"@iterable-iterator/list": "^0.0.2",
"@iterable-iterator/map": "^0.0.1",
"@iterable-iterator/next": "^0.0.1",
"@iterable-iterator/reversed": "^0.0.2"
},
"devDependencies": {
"@aureooms/js-compare": "^2.0.1",
"@aureooms/js-itertools": "^5.1.1",
"@babel/core": "7.13.15",
"@babel/preset-env": "7.13.15",
"@babel/register": "7.13.14",
"@commitlint/cli": "12.1.1",
"@iterable-iterator/range": "^0.0.1",
"@js-library/commitlint-config": "0.0.4",
"ava": "3.15.0",
"babel-plugin-transform-remove-console": "6.9.4",
Expand Down
4 changes: 3 additions & 1 deletion src/diagonal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {deque} from '@aureooms/js-collections-deque';

import {iter, _next, count} from '@aureooms/js-itertools';
import {iter} from '@iterable-iterator/iter';
import {_next} from '@iterable-iterator/next';
import {count} from '@iterable-iterator/count';

/**
* Computes the product of two iterables in a way that allows for one or both
Expand Down
5 changes: 4 additions & 1 deletion src/product.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {list, ncycle, map, reversed} from '@aureooms/js-itertools';
import {list} from '@iterable-iterator/list';
import {reversed} from '@iterable-iterator/reversed';
import {ncycle} from '@iterable-iterator/cycle';
import {map} from '@iterable-iterator/map';

import _product from './_product.js';

Expand Down
5 changes: 4 additions & 1 deletion test/src/diagonal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import test from 'ava';

import {lexicographical, increasing} from '@aureooms/js-compare';

import {list, range, count, take, sorted} from '@aureooms/js-itertools';
import {take, sorted} from '@aureooms/js-itertools';
import {list} from '@iterable-iterator/list';
import {range} from '@iterable-iterator/range';
import {count} from '@iterable-iterator/count';

import {product, diagonal} from '../../src/index.js';

Expand Down
2 changes: 1 addition & 1 deletion test/src/product.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {list} from '@aureooms/js-itertools';
import {list} from '@iterable-iterator/list';

import {product} from '../../src/index.js';

Expand Down
42 changes: 42 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,48 @@
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98"
integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==

"@iterable-iterator/count@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@iterable-iterator/count/-/count-0.0.1.tgz#b3224aa6df617a285b175df1cf08ab7842edbbea"
integrity sha512-BWaGS9sHe2VgzzteyZIc+fNPtPymeLt3gK0V2d618u+tAzkKidNLp40R2pblHu4hgWWiks8vg4srJS8NZaK95w==

"@iterable-iterator/cycle@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@iterable-iterator/cycle/-/cycle-0.0.1.tgz#e500ee5a7861d97c9bf25a875b0311e8e7efad0c"
integrity sha512-Ow8OZkB4SwrMpRPcSByrKjs74O0XnKjtRwWAuLqYW80v8bxeeMFIA+eD/wzkwAqZuqDTNfPD8CnC+J2aY23YUA==

"@iterable-iterator/iter@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@iterable-iterator/iter/-/iter-0.0.2.tgz#7129988de2071ffb747632bd0190c0db579a5b69"
integrity sha512-+q2BxI+awes71qm4M5zLXaJK7GUy1Tbt5K7YKTU3Yl8DgCdQxeHBbkAIxXAv49BoS2eLx5cLXHdpX6ybzvA2XQ==

"@iterable-iterator/list@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@iterable-iterator/list/-/list-0.0.2.tgz#6289761d3ada6bb88f0c92683367ea960f310869"
integrity sha512-103Wwqx0x8neIFjm0GVR7cmEcv29Eg7F4lX72sr9L6FzMH9lp50ejfroAdbdMT37TWq2KVNo1eEWXtFo9hBybw==

"@iterable-iterator/map@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@iterable-iterator/map/-/map-0.0.1.tgz#13dd222dd384d934741d96197c0d963c5678760d"
integrity sha512-uB9ndHoHIditj/0+WiyZou2NqEi7yHESkL0pSC6LfVRPQcwfRUrtzd9+P002Zu8/bdm7xSYZCgTl6SIpjJxORw==

"@iterable-iterator/next@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@iterable-iterator/next/-/next-0.0.1.tgz#7984c31c305864f3a3922bc44ea6333db71e8645"
integrity sha512-7XF4GNoHJLfOcWCh0R0MUJriUJodIrJHTKA5kJTn+hbnl92p1w3pU7CY6XE5KnP4sBBsxtB5UrEAWkZ0+8C8cg==
dependencies:
"@aureooms/js-error" "^5.0.3"

"@iterable-iterator/range@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@iterable-iterator/range/-/range-0.0.1.tgz#44516a8967f9b21546a76ae9c3dbc22e8d782c20"
integrity sha512-fNhvqQLC6xMdbaPrvgDCuUQSHtv9IUDVVAZf2aK7hIEHK6ghd3r5FEX1IYHfDnnXv+zdBfUSr83fg6VB/6/0ug==

"@iterable-iterator/reversed@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@iterable-iterator/reversed/-/reversed-0.0.2.tgz#a8f0e5338d6eeba75a2f596aeae0347edcc0607a"
integrity sha512-RtvSHRBvdm4gzgfkA+6R1TrgPK5JfqN7yKqxLpkfedf2ajiJ3YFTfUAGmTY/ud9fBPwxdt9Js9HT8oXGRw2COQ==

"@js-library/[email protected]":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@js-library/commitlint-config/-/commitlint-config-0.0.4.tgz#5243a58b0d4ad36999d4b944c7770c50658c68f5"
Expand Down

0 comments on commit 38b5046

Please sign in to comment.