1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 17:14:12 +01:00

Get rid of most remaining comprehensions.

This commit is contained in:
Kris Maglione
2015-12-20 15:53:43 -08:00
parent 0aba8fb619
commit 916ea412a5
34 changed files with 372 additions and 256 deletions

View File

@@ -306,9 +306,12 @@ var Events = Module("events", {
* @param {string} filter A regular expression filter string. A null
* filter selects all macros.
*/
getMacros: function (filter) {
getMacros: function (filter = null) {
let re = RegExp(filter || "");
return ([k, m.text] for ([k, m] of editor.registers) if (re.test(k)));
return Array.from(editor.registers,
([key, macro]) => [key, macro.text])
.filter(([key]) => re.test(key));
},
/**
@@ -1026,7 +1029,7 @@ var Events = Module("events", {
completion: function initCompletion() {
completion.macro = function macro(context) {
context.title = ["Macro", "Keys"];
context.completions = [item for (item of events.getMacros())];
context.completions = Array.from(events.getMacros());
};
},
mappings: function initMappings() {