Skip to content

Instantly share code, notes, and snippets.

@bindiego
bindiego / arr2dict.js
Last active August 10, 2022 00:42
Use filebeat to deal with csv / tsv with header as first line
function convert_csv_to_dict(csv_headers_row, csv_values_row) {
var json_from_csv = csv_values_row.reduce(function(result, field, index) {
result[csv_headers_row[index]] = field;
return result;
}, {})
return json_from_csv;
}
var headers_fn = (function() {