Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

just-cartesian-product

angus-c974MIT4.2.0TypeScript support: included

Cartesian product of arrays

array, list, algorithm, cartesian, product, just

readme

just-cartesian-product

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-cartesian-product
yarn add just-cartesian-product

Takes an input of an array of arrays and returns their Cartesian product.

import cartesianProduct from 'just-cartesian-product';

cartesianProduct([[1, 2], ['a', 'b']]); // [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
cartesianProduct([[1, 2], ['a', 'b', 'c']]); // [[1, 'a'], [1, 'b'], [1, 'c'], [2, 'a'], [2, 'b'], [2, 'c']]
cartesianProduct([]); // []
cartesianProduct(); // throws

changelog

just-cartesian-product

4.2.0

Minor Changes

  • Rename node module .js -> .cjs

4.1.1

Patch Changes

  • fix: reorder exports to set default last #488

4.1.0

Minor Changes

  • package.json updates to fix #467 and #483