Skip to content

Instantly share code, notes, and snippets.

View DiesIrae's full-sized avatar

Benoit R DiesIrae

View GitHub Profile
@DiesIrae
DiesIrae / cartprod.js
Last active August 20, 2020 08:42 — forked from sam-roth/cartprod.js
Google Sheets Function for Cartesian Products
// Usually, you'll want to transpose the input (`CARTESIAN_PRODUCT(TRANSPOSE(X1:Y2))`)
function CARTESIAN_PRODUCT(args) {
if (args.length === 0) {
return [];
}
var first = args[0].filter(function (x) { return x !== ""; });
if (args.length === 1) {
return first;