`findAbove` returns the current row value
Closed this issue · 0 comments
pashagolub commented
If I try to find the value from a previous row, I always get the current row value, which is not what I expect from the function with findAbove
name.
The fix is trivial:
findAbove(column: string, options: any) {
const regexp = new RegExp(options.hash.regexp || ".+");
let i: number = options.data.root.ROW.index - 1;
^^^^^^^
while (i >= 0) {
const row = options.data.root.SHEET[i];
const cell = row[column] || "";
const match = cell.match(regexp);
if (match) {
if (options.hash.group) {
return match[options.hash.group];
}
return cell;
}
i--;
}
return null;
},