mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-16 20:25:47 +01:00
Cleanup horrible AbbrevHive.merged getter a bit.
This commit is contained in:
@@ -79,27 +79,10 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
|
|||||||
* each mode.
|
* each mode.
|
||||||
*/
|
*/
|
||||||
get merged() {
|
get merged() {
|
||||||
let result = [];
|
// Wth? --Kris;
|
||||||
let lhses = [];
|
let map = array(values(this._store)).map(Iterator).map(iter.toArray)
|
||||||
let modes = [mode for (mode in this._store)];
|
.flatten().toObject();
|
||||||
|
return Object.keys(map).sort().map(function (k) map[k]);
|
||||||
for (let [, abbrevs] in Iterator(this._store))
|
|
||||||
lhses = lhses.concat([key for (key in abbrevs)]);
|
|
||||||
lhses.sort();
|
|
||||||
lhses = array.uniq(lhses);
|
|
||||||
|
|
||||||
for (let [, lhs] in Iterator(lhses)) {
|
|
||||||
let exists = {};
|
|
||||||
for (let [, abbrevs] in Iterator(this._store)) {
|
|
||||||
let abbr = abbrevs[lhs];
|
|
||||||
if (abbr && !exists[abbr.rhs]) {
|
|
||||||
exists[abbr.rhs] = 1;
|
|
||||||
result.push(abbr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user