cartesian-map
This small library contains a map
-like function that iterates over elements of an array (or over characters of a string), calls a user-provided function on each, and returns the cartesian product of the lists returned by the function for each of the elements.
Examples
ArrayprototypecartesianMap = ;StringprototypecartesianMap = ; console;/*[ [ false, false, false ], [ false, false, true ], [ false, true, false ], [ false, true, true ], [ true, false, false ], [ true, false, true ], [ true, true, false ], [ true, true, true ]]*/ console;// or - alternatively - omitting square brackets for single elements:console;/*[ [ 2, 11, 24, 39 ], [ 2, 11, 24, 42 ], [ 2, 12, 24, 39 ], [ 2, 12, 24, 42 ]]*/ console;/*[ 'Foo Bar', 'Foo bar', 'foo Bar', 'foo bar' ]*/ console;/*[ '', 'r', 'a', 'ar', 'b', 'br', 'ba', 'bar' ]*/