Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseField (f, k, emptyIsFalse) {
if (typeof f !== "string" && !(f instanceof String)) return f
// type can be an array or single thing.
var isPath = -1 !== [].concat(types[k]).indexOf(path)
, isBool = -1 !== [].concat(types[k]).indexOf(Boolean)
, isString = -1 !== [].concat(types[k]).indexOf(String)
f = ini.unsafe((""+f).trim())
if (isBool && !isString && f === "") return f = true
switch (f) {
case "true": return true
case "false": return false
case "null": return null
case "undefined": return undefined
}
f = envReplace(f)
if (isPath) {
var homePattern = process.platform === "win32" ? /^~(\/|\\)/ : /^~\//
if (f.match(homePattern) && process.env.HOME) {
f = path.resolve(process.env.HOME, f.substr(2))
}
f = path.resolve(f)
function parseField (f, k, emptyIsFalse) {
if (typeof f !== "string" && !(f instanceof String)) return f
// type can be an array or single thing.
var isPath = -1 !== [].concat(types[k]).indexOf(path)
, isBool = -1 !== [].concat(types[k]).indexOf(Boolean)
, isString = -1 !== [].concat(types[k]).indexOf(String)
f = ini.unsafe((""+f).trim())
if (isBool && !isString && f === "") return f = true
switch (f) {
case "true": return true
case "false": return false
case "null": return null
case "undefined": return undefined
}
f = envReplace(f)
if (isPath) {
var homePattern = process.platform === "win32" ? /^~(\/|\\)/ : /^~\//
if (f.match(homePattern) && process.env.HOME) {
f = path.resolve(process.env.HOME, f.substr(2))
}
f = path.resolve(f)