diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-27 17:26:25 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-27 17:26:25 -0800 |
commit | f5d9728cff02741a8e4dddc4e1da54602e88b718 (patch) | |
tree | dc77825f65df2b4b186b8754ae5e68680f86e055 /src/utility.js | |
parent | 52cc5c714d852d39a8bfd652f331b4f9b76b2f36 (diff) |
fix global indexing bugs
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 8 |
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)); } |