combine = (arr) => {
let strBuffer = null;
const combined = [];
for (let i = 0; i < arr.length; i++) {
const d = arr[i];
if (typeof d === "string") {
if (!i || strBuffer === null) {
strBuffer = d;
} else {
strBuffer += d;
}
} else {
if (strBuffer !== null) {
combined.push(strBuffer);
strBuffer = null;
}
combined.push(d);
}
}
if (strBuffer !== null) combined.push(strBuffer);
return combined;
}