Convert data chunk to csv lines with cols
@param  {[type]} data   [description]
@param  {[type]} params [description]
@return {[type]}    {lines:[[col1,col2,col3]],partial:String}
502611
function(fileLine, params) {
              var lines = fileLine.lines;
              var csvLines = csvline(lines,params);
              return {
                lines: csvLines.lines,
                partial: csvLines.partial + fileLine.partial
              };
            }
1195225
function(filedata, callback) {
        var lines;
        lines = filedata.toString().split(/(?:\r\n|\r|\n)/gm);
        if (module.exports.verify(lines)) {
            return callback(undefined, lines);
        }
        return callback('INVALID_SRT_FORMAT');
    }
1055656
function (data) {
    var str = '', start = true;
    var jsondata = '';
    for (var key in data) {
      if (typeof (jsondata = JSON.stringify(data[key])) === 'string') {
        str += (start? '': '&');
        str += encodeURIComponent(key) + '=' + encodeURIComponent(jsondata);
        if (start) { start = false; }
      }
    }
    return str;
  }
359425
function splitData(raw) {
	var lines = raw.split( "\n" );
	var line = lines[0];
	var vals = {};
	line.split(" ").forEach(function(kvp){
		var data = kvp.split(":");
		vals[data[0]] = data[1];
	});
	if ( lines.length > 1 ) {
		lines.splice( 0 , 1 );
		vals.body = lines;
	}
	return vals;
}
374620
function csvLine(fields) {
	var line = "";
	fields.forEach(field => { 
		if (line.length > 0)
			line += ";"
		line += typeof field === "number" ? field : '"' + field.toString().replace(/"/g, '""') + '"';
	});
	line += "\n";
	return line;
}
373989
function(fields, data) {
    if (!_.isString(fields)) {
      return data;
    }

    // If a field is specified as `foo.bar` or `foo.bar.baz`,
    // Convert it to just `foo`
    var map = {};
    _.forEach(fields.split(','), function(field) {
      map[field.split('.')[0]] = 1;
    });

    var keys = _.keys(map);
    if (_.isArray(data)) {
      data = _.map(data, function(object) {
        return _.pick(object, keys);
      });
    } else if (_.isObject(data)) {
      data = _.pick(data, keys);
    }

    return data;
  }
892177
function(mode, wid, name, type, units, data)
       {
          var padded4 = (data.length + 3) >> 2;
          var pad = Buffer.alloc( (padded4<<2) - data.length);
          var format = 'CCSLLLCxxxLaa';
          var requestLength = 6 + padded4;
          var dataLenInFormatUnits = data.length / (units >> 3);
          return [format, [18, mode, requestLength, wid, name, type, units, dataLenInFormatUnits, data, pad] ];
       }
1328431
function(data, padding) {

		var result = this._serializeFunction_Normal(data),
			lines = result.split(/\r?\n/),
			last_line = lines[lines.length - 1],
			tabs,
			num_tabs,
			i = 1,
			count = lines.length;

		if (/^\t*\}$/.test(last_line)) {
			if (last_line.length > 1) { // if there are tabs
				tabs = last_line.substr(0, last_line.length - 1);
				num_tabs = tabs.length;
				for (; i < count; i++) {
					if (lines[i].indexOf(tabs) == 0) {
						lines[i] = lines[i].substr(num_tabs);
					}
				}
			}
			lines.pop();
			result = lines.join('\r\n\t' + padding) + '\r\n' + padding + last_line;
		}

		return result;

	}
1089772
function parseData(data, mode) {
    	    var parsed = '';
    	    var parameters = data.split(/\n/);
    	    var regPlaceHolder = /(\{\d+\})/g;
    	    var regRepPlaceHolder = /\{(\d+)\}/g;
    	    var unicodeRE = /(\\u.{4})/ig;
            var i = 0, l = parameters.length;
    	    for (i = 0; i < l; i++) {
    		parameters[i] = parameters[i].replace(/^\s\s*/, '').replace(/\s\s*$/, ''); // trim
    		if (parameters[i].length > 0 && parameters[i].match("^#") != "#") { // skip
    										    // comments
    		    var pair = parameters[i].split('=');
    		    if (pair.length > 0) {
    			/** Process key & value */
    			var name = unescape(pair[0]).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); // trim
    			var value = pair.length == 1 ? "" : pair[1];
    			// process multi-line values
    			while (value.match(/\\$/) == "\\") {
    			    value = value.substring(0, value.length - 1);
    			    value += parameters[++i].replace(/\s\s*$/, ''); // right
    									    // trim
    			}
    			// Put values with embedded '='s back together
    			for (var s = 2; s < pair.length; s++) {
    			    value += '=' + pair[s];
    			}
    			value = value.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); // trim

    			/** Mode: bundle keys in a map */
    			if (mode == 'map' || mode == 'both') {
    			    // handle unicode chars possibly left out
    			    var unicodeMatches = value.match(unicodeRE);
    			    if (unicodeMatches) {
    				for (var u = 0; u < unicodeMatches.length; u++) {
    				    value = value.replace(unicodeMatches[u], unescapeUnicode(unicodeMatches[u]));
    				}
    			    }
    			    // add to map
    			    i18n.map[name] = value;
    			}

    			/* Mode: bundle keys as vars/functions */
    			if (mode == 'vars' || mode == 'both') {
    			    value = value.replace(/"/g, '\\"'); // escape quotation mark

    			    // make sure namespaced key exists (eg, some.key')
    			    checkKeyNamespace(name);

    			    // value with variable substitutions
    			    if (regPlaceHolder.test(value)) {
    				var parts = value.split(regPlaceHolder);
    				// process function args
    				var first = true;
    				var fnArgs = '';
    				var usedArgs = [];
    				for (var p = 0; p < parts.length; p++) {
    				    if (regPlaceHolder.test(parts[p]) && (usedArgs.length === 0 || usedArgs.indexOf(parts[p]) === -1)) {
    					if (!first) {
    					    fnArgs += ',';
    					}
    					fnArgs += parts[p].replace(regRepPlaceHolder, 'v$1');
    					usedArgs.push(parts[p]);
    					first = false;
    				    }
    				}
    				parsed += name + '=function(' + fnArgs + '){';
    				// process function body
    				var fnExpr = '"' + value.replace(regRepPlaceHolder, '"+v$1+"') + '"';
    				parsed += 'return ' + fnExpr + ';' + '};';

    				// simple value
    			    } else {
    				parsed += name + '="' + value + '";';
    			    }
    			} // END: Mode: bundle keys as vars/functions
    		    } // END: if(pair.length > 0)
    		} // END: skip comments
    	    }
    	    //eval(parsed);
            /* TODO: refactor */
    	}
1056734
function csv2json(csvData) {
  var result = {};
  var csvLines = csvData.toString().split('\n');
  for (var i in csvLines) {
    var fields = splitCsvLine(csvLines[i]);
    if (fields.length) {
      var key = '';
      for (var k = 0; k < fields.length - 1; k++) {
        if (fields[k].length) {
          key += '.' + fields[k];
        }
      }
      result[key.substr(1)] = fields[fields.length - 1];
    }
  }
  return result;
}
1193437
def formatData(data):
    
    condensed = PyVDF.__CondensedOutput
    indentation = PyVDF.__OutputIndentation
    spacing = PyVDF.__OutputSpacing
    def loop(array, tab=''):
      string = ''
      for k, v in array.items():
        string += '{}"{}"'.format(tab,k)
        if isinstance(v, dict):
          string += '{}{{\n{}{}}}\n'.format(
            '' if condensed else '\n' + tab,
            loop(v, tab + indentation),
            tab)
        else:
            string += '{}"{}"\n'.format(spacing, v)
      return string
    return loop(data)
611876
function parseData(data)
{
    var tmp_data = {};
    if (nlib.isString(data)) {
        if (data.match(/\.json/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readJSON(data);
        } else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readYAML(data);
        } else {
            tmp_data = data;
        }
    } else if (nlib.isObject(data) || nlib.isArray(data)) {
        for (var i in data) {
            if (nlib.isString(data[i])) {
                var parsed = parseData(data[i]);
                if (nlib.isString(parsed)) {
                    tmp_data[i] = parsed;
                } else {
                    tmp_data = merge(tmp_data, parsed);
                }
            } else {
                tmp_data = merge(tmp_data, data[i]);
            }
        }
    }
    return tmp_data;
}
903845
def extract_columns(data, *cols):
    
    out = []
    try:
        # for python 2.2:
        # return [ [r[c] for c in cols] for r in data]
        for r in data:
            col = []
            for c in cols:
                col.append(r[c])
            out.append(col)
    except IndexError:
        raise IndexError("data=%s col=%s" % (data, col))
    return out
737999
function wrapData(entry, data, token) {
  let symbol = wrapSymbols[entry.special];
  if (!symbol) return data;
  let symbolVal = new SymbolValue(symbol);
  if (token) {
    symbolVal.line = token.line;
    symbolVal.column = token.column;
  }
  let result = new PairValue(symbolVal, new PairValue(data));
  entry.special = null;
  return result;
}
550486
function camelCaseData(data) {
  const result = {};
  const keys = Object.keys(data);
  keys.forEach((k) => {
    const key = camelCase(k);
    const value = data[k];
    if (isObject(value)) {
      result[key] = camelCaseData(value);
    } else {
      result[key] = value;
    }
  });
  return result;
}
1369165
function(data) {
        var json = {},
            index = 0,
            id,
            text,
            startTimeMicro,
            durationMicro,
            invalidText = /^\s+$/,
            endTimeMicro,
            time,
            lastNonEmptyLine;

        function getLastNonEmptyLine(linesArray) {
            var idx = linesArray.length - 1;
            while (idx >= 0 && !linesArray[idx]) {
                idx--;
            }
            return idx;
        }

        json.captions = [];
        lastNonEmptyLine = getLastNonEmptyLine(data) + 1;

        while (index < lastNonEmptyLine) {
            if (data[index]) {
                text = [];
                //Find the ID line..
                if (/^[0-9]+$/.test(data[index])) {
                    //found id line
                    id = parseInt(data[index], 10);
                    index++;
                }
                if (!data[index].split) {
                    // for some reason this is not a string
                    index++;
                    continue;
                }
                //next line has to be timestamp right? right?
                time = data[index].split(/[\t ]*-->[\t ]*/);
                startTimeMicro = module.exports.translateTime(time[0]);
                endTimeMicro = module.exports.translateTime(time[1]);
                durationMicro = parseInt(parseInt(endTimeMicro, 10) - parseInt(startTimeMicro, 10), 10);
                if (!startTimeMicro || !endTimeMicro) {
                    // no valid timestamp
                    index++;
                    continue;
                }
                index++;
                while (data[index]) {
                    text.push(data[index]);
                    index++;
                    if (!data[index] && !invalidText.test(text.join('\n'))) {
                        json.captions.push({
                            id: id,
                            text: module.exports.addMacros(text.join('\n')),
                            startTimeMicro: startTimeMicro,
                            durationSeconds: parseInt(durationMicro / 1000, 10) / 1000,
                            endTimeMicro: endTimeMicro
                        });
                        break;
                    }
                }
            }
            index++;
        }
        return json.captions;

    }
997835
function (data, clamp) {
        var point = this.dataToPoint(data, clamp);

        return {
            contentShape: {
                x: point[0] - (this._sw - this._lineWidth) / 2,
                y: point[1] - (this._sh - this._lineWidth) / 2,
                width: this._sw - this._lineWidth,
                height: this._sh - this._lineWidth
            },

            center: point,

            tl: [
                point[0] - this._sw / 2,
                point[1] - this._sh / 2
            ],

            tr: [
                point[0] + this._sw / 2,
                point[1] - this._sh / 2
            ],

            br: [
                point[0] + this._sw / 2,
                point[1] + this._sh / 2
            ],

            bl: [
                point[0] - this._sw / 2,
                point[1] + this._sh / 2
            ]

        };
    }