aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js
index f3ece90b..84b50ce9 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -282,6 +282,14 @@ function setIntersect(x, y) {
return ret;
}
+function invertArray(x) {
+ var ret = {};
+ for (var i = 0; i < x.length; i++) {
+ ret[x[i]] = i;
+ }
+ return ret;
+}
+
function copy(x) {
return JSON.parse(JSON.stringify(x));
}