Permalink
Browse files

Parse true/false/null/undefined config values before path interpolation.

  • Loading branch information...
1 parent 100f137 commit 19bf596460e94335728645a7419e4fc73effa402 @chromakode chromakode committed with isaacs Mar 20, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/utils/ini.js
View
@@ -110,7 +110,13 @@ function parseField (f, k) {
// type can be an array or single thing.
var isPath = -1 !== [].concat(parseArgs.types[k]).indexOf(path)
f = (""+f).trim()
- if (f === "") f = true
+ if (f === "") return f = true
+ switch (f) {
+ case "true": return f = true
+ case "false": return f = false
+ case "null": return f = null
+ case "undefined": return f = undefined
+ }
if (isPath) {
if (f.substr(0, 2) === "~/" && process.env.HOME) {
f = path.join(process.env.HOME, f.substr(2))
@@ -119,12 +125,6 @@ function parseField (f, k) {
f = path.join(process.cwd(), f.substr(2))
}
}
- switch (f) {
- case "true": f = true; break
- case "false": f = false; break
- case "null": f = null; break
- case "undefined": f = undefined; break
- }
return f
}

0 comments on commit 19bf596

Please sign in to comment.