packages/core/lib/misc/ini.js
function(obj, section, options = {}) {
    var children, dotSplit, out, safe;
    if (arguments.length === 2) {
      options = section;
      section = void 0;
    }
    if (options.separator == null) {
      options.separator = ' = ';
    }
    if (options.eol == null) {
      options.eol = !options.ssh && process.platform === "win32" ? "\r\n" : "\n";
    }
    if (options.escape == null) {
      options.escape = true;
    }
    safe = module.exports.safe;
    dotSplit = module.exports.dotSplit;
    children = [];
    out = "";
    Object.keys(obj).forEach(function(k, _, __) {
      var val;
      val = obj[k];
      if (val && Array.isArray(val)) {
        return val.forEach(function(item) {
          return out += safe(`${k}[]`) + options.separator + safe(item) + options.eol;
        });
      } else if (val && typeof val === "object") {
        return children.push(k);
      } else if (typeof val === 'boolean') {
        if (val === true) {
          return out += safe(k) + options.eol;
        } else {

        }
      } else {
        // disregard false value
        return out += safe(k) + options.separator + safe(val) + options.eol;
      }
    });
    if (section && out.length) {
      out = "[" + safe(section) + "]" + options.eol + out;
    }
    children.forEach((k, _, __) => {
      var child, nk;
      // escape the section name dot as some daemon could not parse it
      nk = options.escape ? dotSplit(k).join('\\.') : k;
      child = module.exports.stringify(obj[k], (section ? section + "." : "") + nk, options);
      if (out.length && child.length) {
        out += options.eol;
      }
      return out += child;
    });
    return out;
  }
function(obj, section, options = {}) {
    var children, dotSplit, out, safe;
    if (arguments.length === 2) {
      options = section;
      section = void 0;
    }
    if (options.separator == null) {
      options.separator = ' = ';
    }
    if (options.eol == null) {
      options.eol = !options.ssh && process.platform === "win32" ? "\r\n" : "\n";
    }
    if (options.escape == null) {
      options.escape = true;
    }
    safe = module.exports.safe;
    dotSplit = module.exports.dotSplit;
    children = [];
    out = "";
    Object.keys(obj).forEach(function(k, _, __) {
      var val;
      val = obj[k];
      if (val && Array.isArray(val)) {
        return val.forEach(function(item) {
          return out += safe(`${k}[]`) + options.separator + safe(item) + options.eol;
        });
      } else if (val && typeof val === "object") {
        return children.push(k);
      } else if (typeof val === 'boolean') {
        if (val === true) {
          return out += safe(k) + options.eol;
        } else {

        }
      } else {
        // disregard false value
        return out += safe(k) + options.separator + safe(val) + options.eol;
      }
    });
    if (section && out.length) {
      out = "[" + safe(section) + "]" + options.eol + out;
    }
    children.forEach((k, _, __) => {
      var child, nk;
      // escape the section name dot as some daemon could not parse it
      nk = options.escape ? dotSplit(k).join('\\.') : k;
      child = module.exports.stringify(obj[k], (section ? section + "." : "") + nk, options);
      if (out.length && child.length) {
        out += options.eol;
      }
      return out += child;
    });
    return out;
  }
function ( obj , section , options = { } ) { var children , dotSplit , out , safe ; if ( arguments . length === 2 ) { options = section ; section = void 0 ; } if ( options . separator == null ) { options . separator = ' = ' ; } if ( options . eol == null ) { options . eol = ! options . ssh && process . platform === "win32" ? "\r\n" : "\n" ; } if ( options . escape == null ) { options . escape = true ; } safe = module . exports . safe ; dotSplit = module . exports . dotSplit ; children = [ ] ; out = "" ; Object . keys ( obj ) . forEach ( function ( k , _ , __ ) { var val ; val = obj [ k ] ; if ( val && Array . isArray ( val ) ) { return val . forEach ( function ( item ) { return out += safe ( ` ${ k } ` ) + options . separator + safe ( item ) + options . eol ; } ) ; } else if ( val && typeof val === "object" ) { return children . push ( k ) ; } else if ( typeof val === 'boolean' ) { if ( val === true ) { return out += safe ( k ) + options . eol ; } else { } } else { // disregard false value return out += safe ( k ) + options . separator + safe ( val ) + options . eol ; } } ) ; if ( section && out . length ) { out = "[" + safe ( section ) + "]" + options . eol + out ; } children . forEach ( ( k , _ , __ ) => { var child , nk ; // escape the section name dot as some daemon could not parse it nk = options . escape ? dotSplit ( k ) . join ( '\\.' ) : k ; child = module . exports . stringify ( obj [ k ] , ( section ? section + "." : "" ) + nk , options ) ; if ( out . length && child . length ) { out += options . eol ; } return out += child ; } ) ; return out ; }
same as ini parse but transform value which are true and type of true as '' to be user by stringify_single_key
same as ini parse but transform value which are true and type of true as to be user by stringify_single_key