Skip to content

Commit cd77cdb

Browse files
committed
Check not undefined, not that it isn't null
1 parent 7e2eb3d commit cd77cdb

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ module.exports = function(opt) {
4545
args.push('--unix-newlines');
4646
}
4747

48-
if (options.style !== null) {
48+
if (typeof options.style !== 'undefined') {
4949
args.push('-t', options.style.toString());
5050
}
5151

52-
if (options.format !== null) {
52+
if (typeof options.format !== 'undefined') {
5353
args.push('-f', options.format.toString());
5454
}
5555

@@ -71,23 +71,23 @@ module.exports = function(opt) {
7171
args.push('--cdata');
7272
}
7373

74-
if (options.autoclose !== null) {
74+
if (typeof options.autoclose !== 'undefined') {
7575
var list = options.autoclose;
7676
if (isArray(list)) {
7777
list = list.join(',');
7878
}
7979
args.push('--autoclose', list.toString());
8080
}
8181

82-
if (options.require !== null) {
82+
if (typeof options.require !== 'undefined') {
8383
args.push('-r', '"' + options.require + '"');
8484
}
8585

8686
if (options.suppressEval) {
8787
args.push('--suppress-eval');
8888
}
8989

90-
if (options.loadPath !== null) {
90+
if (typeof options.loadPath !== 'undefined') {
9191
args.push('-I', '"' + options.loadPath + '"');
9292
}
9393

@@ -110,11 +110,15 @@ module.exports = function(opt) {
110110
});
111111

112112
var hamlData = '';
113-
cp.stdout.on('data', function(data) { hamlData += data.toString(); });
113+
cp.stdout.on('data', function(data) {
114+
hamlData += data.toString();
115+
});
114116

115117
var errors = '';
116118
cp.stderr.setEncoding('utf8');
117-
cp.stderr.on('data', function(data) { errors += data.toString(); });
119+
cp.stderr.on('data', function(data) {
120+
errors += data.toString();
121+
});
118122

119123
cp.on('close', function(code) {
120124
if (errors) {

0 commit comments

Comments
 (0)