querysub 0.216.0 → 0.217.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -70,18 +70,30 @@ function textTableLineToObj(text: string): Record<string, string>[] {
|
|
|
70
70
|
// Parse column positions from header
|
|
71
71
|
let columns: { name: string; start: number; end: number }[] = [];
|
|
72
72
|
let headerWords = headerLine.match(/\S+/g) || [];
|
|
73
|
-
let currentPos = 0;
|
|
74
73
|
|
|
75
74
|
for (let i = 0; i < headerWords.length; i++) {
|
|
76
75
|
let word = headerWords[i];
|
|
77
|
-
let
|
|
78
|
-
let
|
|
76
|
+
let wordStart = headerLine.indexOf(word, i === 0 ? 0 : columns[i - 1].end);
|
|
77
|
+
let wordEnd = wordStart + word.length;
|
|
78
|
+
|
|
79
|
+
let columnStart: number;
|
|
80
|
+
let columnEnd: number;
|
|
81
|
+
|
|
82
|
+
if (i === headerWords.length - 1) {
|
|
83
|
+
// Last header: column starts at the start of header word and goes to end of line
|
|
84
|
+
columnStart = wordStart;
|
|
85
|
+
columnEnd = headerLine.length;
|
|
86
|
+
} else {
|
|
87
|
+
// Non-last headers: column starts after previous column and ends at end of header word
|
|
88
|
+
columnStart = i === 0 ? 0 : columns[i - 1].end;
|
|
89
|
+
columnEnd = wordEnd;
|
|
90
|
+
}
|
|
91
|
+
|
|
79
92
|
columns.push({
|
|
80
93
|
name: word,
|
|
81
|
-
start:
|
|
82
|
-
end:
|
|
94
|
+
start: columnStart,
|
|
95
|
+
end: columnEnd
|
|
83
96
|
});
|
|
84
|
-
currentPos = start + word.length;
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
// Extract values from all data lines
|