Browse Source

Add index argument to transformHeader (#807)

pull/810/head
James Furey 5 years ago committed by GitHub
parent
commit
018f5dfe41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      papaparse.js

8
papaparse.js

@ -1189,10 +1189,10 @@ License: MIT @@ -1189,10 +1189,10 @@ License: MIT
if (!_results)
return;
function addHeder(header)
function addHeader(header, i)
{
if (isFunction(_config.transformHeader))
header = _config.transformHeader(header);
header = _config.transformHeader(header, i);
_fields.push(header);
}
@ -1200,13 +1200,13 @@ License: MIT @@ -1200,13 +1200,13 @@ License: MIT
if (Array.isArray(_results.data[0]))
{
for (var i = 0; needsHeaderRow() && i < _results.data.length; i++)
_results.data[i].forEach(addHeder);
_results.data[i].forEach(addHeader);
_results.data.splice(0, 1);
}
// if _results.data[0] is not an array, we are in a step where _results.data is the row.
else
_results.data.forEach(addHeder);
_results.data.forEach(addHeader);
}
function shouldApplyDynamicTyping(field) {

Loading…
Cancel
Save