Add/update filtered-sum-bms benchmark
This commit is contained in:
37
spot-launcher/node_modules/@smithy/smithy-client/dist-es/split-header.js
generated
vendored
Normal file
37
spot-launcher/node_modules/@smithy/smithy-client/dist-es/split-header.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
export const splitHeader = (value) => {
|
||||
const z = value.length;
|
||||
const values = [];
|
||||
let withinQuotes = false;
|
||||
let prevChar = undefined;
|
||||
let anchor = 0;
|
||||
for (let i = 0; i < z; ++i) {
|
||||
const char = value[i];
|
||||
switch (char) {
|
||||
case `"`:
|
||||
if (prevChar !== "\\") {
|
||||
withinQuotes = !withinQuotes;
|
||||
}
|
||||
break;
|
||||
case ",":
|
||||
if (!withinQuotes) {
|
||||
values.push(value.slice(anchor, i));
|
||||
anchor = i + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
prevChar = char;
|
||||
}
|
||||
values.push(value.slice(anchor));
|
||||
return values.map((v) => {
|
||||
v = v.trim();
|
||||
const z = v.length;
|
||||
if (z < 2) {
|
||||
return v;
|
||||
}
|
||||
if (v[0] === `"` && v[z - 1] === `"`) {
|
||||
v = v.slice(1, z - 1);
|
||||
}
|
||||
return v.replace(/\\"/g, '"');
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user