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