|
6 | 6 | * Values:
|
7 | 7 | *
|
8 | 8 | * - `true`
|
| 9 | + * - `"ignoreProperties"` allows an exception for object property names. Deprecated, Please use the `Object` value |
9 | 10 | * - `Object`:
|
10 | 11 | * - `ignoreProperties`: boolean that allows an exception for object property names
|
11 | 12 | * - `strict`: boolean that forces the first character to not be capitalized
|
@@ -249,49 +250,55 @@ module.exports.prototype = {
|
249 | 250 | configure: function(options) {
|
250 | 251 | if (typeof options !== 'object') {
|
251 | 252 | assert(
|
252 |
| - options === true, |
253 |
| - this.getOptionName() + ' option requires a true value or Object`' |
| 253 | + options === true || options === 'ignoreProperties', |
| 254 | + this.getOptionName() + ' option requires a true value or `ignoreProperties`' |
254 | 255 | );
|
255 |
| - } else { |
256 |
| - assert( |
257 |
| - !options.hasOwnProperty('ignoreProperties') || typeof options.ignoreProperties === 'boolean', |
258 |
| - this.getOptionName() + ' option should have boolean value for ignoreProperties' |
259 |
| - ); |
260 |
| - this._ignoreProperties = options.ignoreProperties; |
| 256 | + var _options = { |
| 257 | + ignoreProperties: options === 'ignoreProperties' ? true : false, |
| 258 | + strict: false |
| 259 | + }; |
| 260 | + return this.configure(_options); |
| 261 | + } |
261 | 262 |
|
262 |
| - assert( |
263 |
| - !options.hasOwnProperty('strict') || typeof options.strict === 'boolean', |
264 |
| - this.getOptionName() + ' option should have boolean value for strict' |
265 |
| - ); |
266 |
| - this._strict = options.strict; |
| 263 | + assert( |
| 264 | + !options.hasOwnProperty('ignoreProperties') || typeof options.ignoreProperties === 'boolean', |
| 265 | + this.getOptionName() + ' option should have boolean value for ignoreProperties' |
| 266 | + ); |
| 267 | + this._ignoreProperties = options.ignoreProperties; |
267 | 268 |
|
268 |
| - var asre = processArrayOfStringOrRegExp(options.allowedPrefixes); |
269 |
| - assert( |
270 |
| - !options.hasOwnProperty('allowedPrefixes') || asre, |
271 |
| - this.getOptionName() + ' option should have array of string or RegExp for allowedPrefixes' |
272 |
| - ); |
273 |
| - if (asre) { |
274 |
| - this._allowedPrefixes = asre; |
275 |
| - } |
| 269 | + assert( |
| 270 | + !options.hasOwnProperty('strict') || typeof options.strict === 'boolean', |
| 271 | + this.getOptionName() + ' option should have boolean value for strict' |
| 272 | + ); |
| 273 | + this._strict = options.strict; |
276 | 274 |
|
277 |
| - asre = processArrayOfStringOrRegExp(options.allowedSuffixes); |
278 |
| - assert( |
279 |
| - !options.hasOwnProperty('allowedSuffixes') || asre, |
280 |
| - this.getOptionName() + ' option should have array of string or RegExp for allowedSuffixes' |
281 |
| - ); |
282 |
| - if (asre) { |
283 |
| - this._allowedSuffixes = asre; |
284 |
| - } |
| 275 | + var asre = processArrayOfStringOrRegExp(options.allowedPrefixes); |
| 276 | + assert( |
| 277 | + !options.hasOwnProperty('allowedPrefixes') || asre, |
| 278 | + this.getOptionName() + ' option should have array of string or RegExp for allowedPrefixes' |
| 279 | + ); |
| 280 | + if (asre) { |
| 281 | + this._allowedPrefixes = asre; |
| 282 | + } |
285 | 283 |
|
286 |
| - asre = processArrayOfStringOrRegExp(options.allExcept); |
287 |
| - assert( |
288 |
| - !options.hasOwnProperty('allExcept') || asre, |
289 |
| - this.getOptionName() + ' option should have array of string or RegExp for allExcept' |
290 |
| - ); |
291 |
| - if (asre) { |
292 |
| - this._allExcept = asre; |
293 |
| - } |
| 284 | + asre = processArrayOfStringOrRegExp(options.allowedSuffixes); |
| 285 | + assert( |
| 286 | + !options.hasOwnProperty('allowedSuffixes') || asre, |
| 287 | + this.getOptionName() + ' option should have array of string or RegExp for allowedSuffixes' |
| 288 | + ); |
| 289 | + if (asre) { |
| 290 | + this._allowedSuffixes = asre; |
| 291 | + } |
| 292 | + |
| 293 | + asre = processArrayOfStringOrRegExp(options.allExcept); |
| 294 | + assert( |
| 295 | + !options.hasOwnProperty('allExcept') || asre, |
| 296 | + this.getOptionName() + ' option should have array of string or RegExp for allExcept' |
| 297 | + ); |
| 298 | + if (asre) { |
| 299 | + this._allExcept = asre; |
294 | 300 | }
|
| 301 | + |
295 | 302 | },
|
296 | 303 |
|
297 | 304 | getOptionName: function() {
|
|
0 commit comments