From 018f5dfe419c68f4f084df3d4452190cd501a74a Mon Sep 17 00:00:00 2001 From: James Furey Date: Thu, 25 Jun 2020 06:20:05 +1000 Subject: [PATCH] Add index argument to transformHeader (#807) --- papaparse.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/papaparse.js b/papaparse.js index ec493732..49344721 100755 --- a/papaparse.js +++ b/papaparse.js @@ -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 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) {