index.js
function ini2json(iniData) {
  var result = {};
  var iniLines = iniData.toString().split('\n');
  var context = null;
  for (var i in iniLines) {
    var fields = splitIniLine(iniLines[i]);
    for (var j in fields) {
      fields[j] = fields[j].trim();
    }
    if (fields[0].length) {
      if (fields[0].indexOf('[')===0) {
        context = fields[0].substring(1, fields[0].length - 1);
      } else {
        if (context) {
          if (!result[context]) {
            result[context] = {};
          }
          result[context][fields[0]] = fields[1];
        } else {
          result[fields[0]] = fields[1];
        }
      }
    }
  }
  return result;
}
function ini2json(iniData) {
  var result = {};
  var iniLines = iniData.toString().split('\n');
  var context = null;
  for (var i in iniLines) {
    var fields = splitIniLine(iniLines[i]);
    for (var j in fields) {
      fields[j] = fields[j].trim();
    }
    if (fields[0].length) {
      if (fields[0].indexOf('[')===0) {
        context = fields[0].substring(1, fields[0].length - 1);
      } else {
        if (context) {
          if (!result[context]) {
            result[context] = {};
          }
          result[context][fields[0]] = fields[1];
        } else {
          result[fields[0]] = fields[1];
        }
      }
    }
  }
  return result;
}
function ini2json ( iniData ) { var result = { } ; var iniLines = iniData . toString ( ) . split ( '\n' ) ; var context = null ; for ( var i in iniLines ) { var fields = splitIniLine ( iniLines [ i ] ) ; for ( var j in fields ) { fields [ j ] = fields [ j ] . trim ( ) ; } if ( fields [ 0 ] . length ) { if ( fields [ 0 ] . indexOf ( '[' ) === 0 ) { context = fields [ 0 ] . substring ( 1 , fields [ 0 ] . length - 1 ) ; } else { if ( context ) { if ( ! result [ context ] ) { result [ context ] = { } ; } result [ context ] [ fields [ 0 ] ] = fields [ 1 ] ; } else { result [ fields [ 0 ] ] = fields [ 1 ] ; } } } } return result ; }
Simple conversion helper to get a json file from an ini file.
@param {String} iniData
@returns {{}}
Simple conversion helper to get a json file from an ini file .