Last active
February 28, 2022 18:14
-
-
Save aleph-naught2tog/38d03b8390bd759f9d2e4564bcb2c3e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const cartesianProduct = (...colls: unknown[][]) => | |
colls.reduce<unknown[][]>( | |
(products, coll) => | |
products.flatMap((product) => coll.map((value) => [...product, value])), | |
[[]] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment