console.log("text: '" + text + "', removeBeginning: '" + removeBeginning +
"', removeEnding: '" + removeEnding + "', removeMiddle: '" + removeMiddle + "'");
let result = text;
if (removeBeginning === true) {
result = result.trimStart();
}
if (removeEnding === true) {
result = result.trimEnd();
}
if (removeMiddle) {
result = result.replace(/\s\s+/g, ' ')
}
return {
"result": result
};