1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 05:04:11 +01:00

Use builtin String.startsWith, String.endsWith, and String.contains methods where appropriate.

This commit is contained in:
Kris Maglione
2014-02-22 15:17:08 -08:00
parent 6790c62c41
commit 51eb03c376
19 changed files with 40 additions and 39 deletions

View File

@@ -764,7 +764,7 @@ var Commands = Module("commands", {
return "";
}
// TODO: allow matching of aliases?
function cmds(hive) hive._list.filter(cmd => cmd.name.indexOf(filter || "") == 0)
function cmds(hive) hive._list.filter(cmd => cmd.name.startsWith(filter || ""))
let hives = (hives || this.userHives).map(h => [h, cmds(h)])
.filter(([h, c]) => c.length);
@@ -1067,7 +1067,7 @@ var Commands = Module("commands", {
if (!onlyArgumentsRemaining) {
for (let [, opt] in Iterator(options)) {
for (let [, optname] in Iterator(opt.names)) {
if (sub.indexOf(optname) == 0) {
if (sub.startsWith(optname)) {
let count = 0;
let invalid = false;
let arg, quote, quoted;