Skip to content

Commit bf3d2d6

Browse files
committed
Case-insensitive mapping
1 parent 42afade commit bf3d2d6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/DataHarmonizer.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1489,8 +1489,16 @@ class DataHarmonizer {
14891489
// Map current column indices to their indices in matrix to map
14901490
const headerMap = {};
14911491
const unmappedHeaders = [];
1492-
for (const [i, expectedVal] of expectedSecondaryHeaders.entries()) {
1492+
for (let [i, expectedVal] of expectedSecondaryHeaders.entries()) {
14931493
headerMap[i] = actualSecondaryHeaders.findIndex((actualVal) => {
1494+
// Case insensitivity
1495+
if (typeof actualVal === 'string' || actualVal instanceof String) {
1496+
actualVal = actualVal.toLowerCase()
1497+
}
1498+
if (typeof expectedVal === 'string' || expectedVal instanceof String) {
1499+
expectedVal = expectedVal.toLowerCase()
1500+
}
1501+
14941502
return actualVal === expectedVal;
14951503
});
14961504
if (headerMap[i] === -1) {

0 commit comments

Comments
 (0)