1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-30 01:53:33 +02: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

@@ -474,7 +474,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
sanitizer.sanitize(items, range);
}
if (array.nth(opt.value, i => i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
if ("all" == opt.value.find(i => (i == "all" ||
/^!/.test(i)))
&& !args["-host"])
modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
function (resp) {
if (resp.match(/^y(es)?$/i)) {
@@ -620,8 +623,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
},
has: function has(val)
let (res = array.nth(this.value, v => (v == "all" || v.replace(/^!/, "") == val),
0))
let (res = this.value.find(v => (v == "all" || v.replace(/^!/, "") == val)))
res && !/^!/.test(res),
validator: function (values) values.length &&