1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 15:27:58 +01:00

Use builtin Array.find rather than array.nth where applicable.

This commit is contained in:
Kris Maglione
2014-02-22 14:57:23 -08:00
parent 414a165e9c
commit 6790c62c41
14 changed files with 58 additions and 43 deletions

View File

@@ -1299,16 +1299,21 @@ var Hints = Module("hints", {
},
{
keepQuotes: true,
getKey: function (val, default_)
let (res = array.nth(this.value, re => let (match = re.exec(val)) match && match[0] == val, 0))
res ? res.matcher : default_,
let (res = this.value.find(re => let (match = re.exec(val)) match && match[0] == val))
res ? res.matcher
: default_,
parse: function parse(val) {
let vals = parse.supercall(this, val);
for (let value in values(vals))
value.matcher = DOM.compileMatcher(Option.splitList(value.result));
return vals;
},
testValues: function testValues(vals, validator) vals.every(re => Option.splitList(re).every(validator)),
validator: DOM.validateMatcher
});