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

Commit

Permalink
Allow true, false, null and custom on command line
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Sep 8, 2013
1 parent aef620f commit 9c71c1e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/preprocess
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ for (;i<process.argv.length; i++) {
console.log("Illegal directive: "+process.argv[i]);
process.exit(12);
}
directives[d[0]] = d.length == 1 || d[1].toLowerCase() === "true" || d[1] === "1" || d[1];
var val;
if (d.length == 1 || d[1].toLowerCase() === "true") {
val = true;
} else if (d[1].toLowerCase() === "false") {
val = false;
} else if (d[1].toLowerCase() === "null") {
val = null;
} else {
val = d[1];
}
directives[d[0]] = val;
}
var source = fs.readFileSync(sourceFile)+"";
var pp = new Preprocessor(source, baseDir);
Expand Down

0 comments on commit 9c71c1e

Please sign in to comment.