How to use the ini.unsafe function in ini

To help you get started, we’ve selected a few ini examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nullivex / nodist / bin / node_modules / npm / lib / utils / ini.js View on Github external
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)
github graalvm / graaljs / deps / npm / lib / utils / ini.js View on Github external
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)

ini

An ini encoder/decoder for node

ISC
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis