summaryrefslogtreecommitdiff
path: root/src/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.js')
-rw-r--r--src/util.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util.js b/src/util.js
index 4e23d9d..8b85ba7 100644
--- a/src/util.js
+++ b/src/util.js
@@ -14,3 +14,10 @@ export function random_choice(collection, r) {
const idx = Math.floor(collection.length * r);
return collection[idx];
}
+
+
+export function pairs(arr1, arr2) {
+ return arr1
+ .map((x, i) => arr2.map(y => [x, y]))
+ .flat();
+}