README
Lists cartesian product of maps. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Similar: cartesianProduct, zip.
This is part of package extra-map.
This is browserified, minified version of @extra-map/cartesian-product.
It is exported as global variable map_cartesianProduct.
CDN: unpkg, jsDelivr.
map.cartesianProduct(xs, fm);
// xs: maps
// fm: map function (vs, i)
const map = require("extra-map");
var x = new Map([["a", 1], ["b", 2], ["c", 3]]);
var y = new Map([["d", 10], ["e", 20]]);
[...map.cartesianProduct([x, y])];
// [
// Map(2) { "a" => 1, "d" => 10 },
// Map(2) { "a" => 1, "e" => 20 },
// Map(2) { "b" => 2, "d" => 10 },
// Map(2) { "b" => 2, "e" => 20 },
// Map(2) { "c" => 3, "d" => 10 },
// Map(2) { "c" => 3, "e" => 20 }
// ]
[...map.cartesianProduct([x, y], a => map.max(a))];
// [
// [ "d", 10 ],
// [ "e", 20 ],
// [ "d", 10 ],
// [ "e", 20 ],
// [ "d", 10 ],
// [ "e", 20 ]
// ]