aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js
index 3d8ce86e..d5583ffb 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -202,3 +202,14 @@ function setSub(x, y) {
return ret;
}
+// Intersection of 2 sets. Faster if |xx| << |yy|
+function setIntersect(x, y) {
+ var ret = {};
+ for (xx in x) {
+ if (xx in y) {
+ ret[xx] = true;
+ }
+ }
+ return ret;
+}
+