fix getOptions
This commit is contained in:
parent
9d81d0e6bb
commit
441dfbad30
2 changed files with 14 additions and 8 deletions
|
|
@ -190,19 +190,25 @@ var optionsProvider = {
|
|||
this.setOption(key, optList[key]);
|
||||
}, this);
|
||||
},
|
||||
getOptions: function(a) {
|
||||
var b = {};
|
||||
Object.keys(a).forEach(function(key) {
|
||||
b[key] = this.getOption(key);
|
||||
getOptions: function(optionNames) {
|
||||
var result = {};
|
||||
if (!optionNames) {
|
||||
optionNames = Object.keys(this.$options);
|
||||
} else if (!Array.isArray(optionNames)) {
|
||||
result = optionNames;
|
||||
optionNames = Object.keys(result);
|
||||
}
|
||||
optionNames.forEach(function(key) {
|
||||
result[key] = this.getOption(key);
|
||||
}, this);
|
||||
return b;
|
||||
return result;
|
||||
},
|
||||
setOption: function(name, value) {
|
||||
if (this["$" + name] === value)
|
||||
return;
|
||||
var opt = this.$options[name];
|
||||
if (!opt)
|
||||
return undefined;
|
||||
return false;
|
||||
if (opt.forwardTo)
|
||||
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
|
||||
|
||||
|
|
@ -214,7 +220,7 @@ var optionsProvider = {
|
|||
getOption: function(name) {
|
||||
var opt = this.$options[name];
|
||||
if (!opt)
|
||||
return undefined;
|
||||
return false;
|
||||
if (opt.forwardTo)
|
||||
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
|
||||
return opt && opt.get ? opt.get.call(this) : this["$" + name];
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ var supportedModes = {
|
|||
Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
|
||||
Markdown: ["md|markdown"],
|
||||
MUSHCode: ["mc|mush"],
|
||||
ObjectiveC: ["m"],
|
||||
ObjectiveC: ["m|mm"],
|
||||
OCaml: ["ml|mli"],
|
||||
Pascal: ["pas|p"],
|
||||
Perl: ["pl|pm"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue