Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 9c71c1e

Browse files
committed
Allow true, false, null and custom on command line
1 parent aef620f commit 9c71c1e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bin/preprocess

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ for (;i<process.argv.length; i++) {
4848
console.log("Illegal directive: "+process.argv[i]);
4949
process.exit(12);
5050
}
51-
directives[d[0]] = d.length == 1 || d[1].toLowerCase() === "true" || d[1] === "1" || d[1];
51+
var val;
52+
if (d.length == 1 || d[1].toLowerCase() === "true") {
53+
val = true;
54+
} else if (d[1].toLowerCase() === "false") {
55+
val = false;
56+
} else if (d[1].toLowerCase() === "null") {
57+
val = null;
58+
} else {
59+
val = d[1];
60+
}
61+
directives[d[0]] = val;
5262
}
5363
var source = fs.readFileSync(sourceFile)+"";
5464
var pp = new Preprocessor(source, baseDir);

0 commit comments

Comments
 (0)