mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-07 10:24:11 +01:00
Better validateCompleter fix.
This commit is contained in:
@@ -94,7 +94,7 @@ var Contexts = Module("contexts", {
|
||||
},
|
||||
|
||||
cleanup: function () {
|
||||
for (let module of this.pluginModules)
|
||||
for each (let module in this.pluginModules)
|
||||
util.trapErrors("unload", module);
|
||||
|
||||
this.pluginModules = {};
|
||||
|
||||
@@ -109,6 +109,8 @@ var Option = Class("Option", {
|
||||
*/
|
||||
parse: function parse(value) Option.dequote(value),
|
||||
|
||||
parseKey: function parseKey(value) value,
|
||||
|
||||
/**
|
||||
* Returns *values* packed in the appropriate format for the option type.
|
||||
*
|
||||
@@ -564,6 +566,11 @@ var Option = Class("Option", {
|
||||
}, this))
|
||||
},
|
||||
|
||||
parseKey: {
|
||||
number: Number,
|
||||
boolean: function boolean(value) value == "true" || value == true ? true : false,
|
||||
},
|
||||
|
||||
testValues: {
|
||||
regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)),
|
||||
get sitemap() this.regexpmap,
|
||||
@@ -742,7 +749,8 @@ var Option = Class("Option", {
|
||||
if (isArray(acceptable))
|
||||
acceptable = RealSet(acceptable.map(([k]) => k));
|
||||
else
|
||||
acceptable = RealSet(this.parse(k) for (k in Object.keys(acceptable)));
|
||||
acceptable = RealSet(this.parseKey(k)
|
||||
for (k of Object.keys(acceptable)));
|
||||
|
||||
if (this.type === "regexpmap" || this.type === "sitemap")
|
||||
return Array.concat(vals).every(re => acceptable.has(re.result));
|
||||
@@ -776,6 +784,9 @@ var Option = Class("Option", {
|
||||
if (type in Option.parse)
|
||||
class_.prototype.parse = Option.parse[type];
|
||||
|
||||
if (type in Option.parseKey)
|
||||
class_.prototype.parseKey = Option.parse[type];
|
||||
|
||||
if (type in Option.stringify)
|
||||
class_.prototype.stringify = Option.stringify[type];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user