You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
552 B
JavaScript
21 lines
552 B
JavaScript
"use strict";
|
|
|
|
module.exports = function stripPlaintextReplyFallback(plaintext) {
|
|
let lines = plaintext.split("\n");
|
|
let firstNonReplyLine = lines.findIndex((line) => !line.startsWith("> "));
|
|
|
|
if (firstNonReplyLine !== -1) {
|
|
let nonReplyLines = lines.slice(firstNonReplyLine);
|
|
let firstNonEmptyLine = nonReplyLines.findIndex((line) => line.length > 0);
|
|
|
|
if (firstNonEmptyLine !== -1) {
|
|
let nonEmptyLines = nonReplyLines.slice(firstNonEmptyLine);
|
|
return nonEmptyLines.join("\n");
|
|
} else {
|
|
return "";
|
|
}
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|