Browse files

allow the 'configure' method to query the status of each configuratio…

…n boolean
  • Loading branch information...
1 parent b1eff85 commit caee2c487d587f2d174b3dd592a9a2bfeb3a4737 @dperini committed Nov 22, 2012
Showing with 14 additions and 8 deletions.
  1. +6 −3 src/nwmatcher-base.js
  2. +8 −5 src/nwmatcher.js
View
9 src/nwmatcher-base.js
@@ -183,9 +183,11 @@
},
configure =
- function(options) {
- for (var i in options) {
- Config[i] = !!options[i];
+ function(option) {
+ if (typeof option == 'string') { return Config[option]; }
+ if (typeof option != 'object') { return false; }
+ for (var i in option) {
+ Config[i] = !!option[i];
if (i == 'SIMPLENOT') {
matchContexts = { };
matchResolvers = { };
@@ -197,6 +199,7 @@
reValidator = RegExp(standardValidator, 'g');
}
}
+ return true;
},
concatCall =
View
13 src/nwmatcher.js
@@ -801,11 +801,13 @@
/*------------------------------- DEBUGGING --------------------------------*/
- // set working mode
+ // get/set (string/object) working modes
configure =
- function(options) {
- for (var i in options) {
- Config[i] = !!options[i];
+ function(option) {
+ if (typeof option == 'string') { return Config[option]; }
+ if (typeof option != 'object') { return false; }
+ for (var i in option) {
+ Config[i] = !!option[i];
if (i == 'SIMPLENOT') {
matchContexts = { };
matchResolvers = { };
@@ -814,10 +816,11 @@
Config['USE_QSAPI'] = false;
reValidator = new RegExp(extendedValidator, 'g');
} else if (i == 'USE_QSAPI') {
- Config[i] = !!options[i] && NATIVE_QSAPI;
+ Config[i] = !!option[i] && NATIVE_QSAPI;
reValidator = new RegExp(standardValidator, 'g');
}
}
+ return true;
},
// control user notifications

0 comments on commit caee2c4

Please sign in to comment.