make last new line optional, closes #1258

This commit is contained in:
Alexander Drozdov
2024-01-24 14:35:37 +02:00
parent 2e58f4e50f
commit 8c8a71264e

View File

@@ -112,7 +112,9 @@ export function parseClipboard (clipboard: string): Result<ParsedItem, string> {
function itemTextToSections (text: string) { function itemTextToSections (text: string) {
const lines = text.split(/\r?\n/) const lines = text.split(/\r?\n/)
if (lines[lines.length - 1] === '') {
lines.pop() lines.pop()
}
const sections: string[][] = [[]] const sections: string[][] = [[]]
lines.reduce((section, line) => { lines.reduce((section, line) => {