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:
@@ -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
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user