fix: wrong trim all white space lyric (#1233)

This commit is contained in:
memorydream 2022-01-17 21:12:40 +08:00 committed by GitHub
parent 585691aa0f
commit 3cbb8d9b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@ export function parseLyric(lrc) {
lrcObj.push({ lrcObj.push({
time: time, time: time,
rawTime: timeRegExpArr[0], rawTime: timeRegExpArr[0],
content: content.trim(), content: trimContent(content),
}); });
} }
} }
@ -36,3 +36,8 @@ export function parseLyric(lrc) {
lrcObj.sort((a, b) => a.time - b.time); lrcObj.sort((a, b) => a.time - b.time);
return lrcObj; return lrcObj;
} }
function trimContent(content) {
let t = content.trim();
return t.length < 1 ? content : t;
}