Skip to content

Commit 04bb00d

Browse files
Reducing nesting, removing extra variables, reporting errors
1 parent 267782d commit 04bb00d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/csscomb.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var vfs = require('vow-fs');
66
/**
77
* Starts Code Style processing process.
88
*
9+
* @constructor
910
* @name Comb
1011
*/
1112
var Comb = function() {
@@ -35,17 +36,18 @@ Comb.prototype = {
3536
* @param {Object} config
3637
*/
3738
configure: function(config) {
38-
var _this = this;
3939
this._handlers = [];
4040
this._options.forEach(function(option) {
41-
if (config[option] !== undefined) {
42-
try {
43-
var handler = require('./options/' + option).setValue(config[option]);
44-
handler && _this._handlers.push(handler);
45-
} catch (e) {
46-
}
41+
if (typeof config[option] === 'undefined') return;
42+
43+
try {
44+
var handler = require('./options/' + option).setValue(config[option]);
45+
handler && this._handlers.push(handler);
46+
} catch (e) {
47+
console.warn('Error loading "%s" handler: %s', option, e.message);
4748
}
48-
});
49+
}, this);
50+
4951
this._exclude = (config.exclude || []).map(function(pattern) {
5052
return new minimatch.Minimatch(pattern);
5153
});

0 commit comments

Comments
 (0)