mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix empty content (fix #4629)
This commit is contained in:
parent
cc0bc33be3
commit
bdf7cb7dba
@ -7,6 +7,9 @@ const normalizeMap = {
|
|||||||
}
|
}
|
||||||
const escapeMap = Object.fromEntries(Object.entries(normalizeMap).map(entry => entry.reverse()))
|
const escapeMap = Object.fromEntries(Object.entries(normalizeMap).map(entry => entry.reverse()))
|
||||||
const replace = (content: string, map: Record<string, string>) => {
|
const replace = (content: string, map: Record<string, string>) => {
|
||||||
|
if (!content) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
for (const [key, value] of Object.entries(map)) {
|
for (const [key, value] of Object.entries(map)) {
|
||||||
content = content.replace(new RegExp(key, 'g'), value)
|
content = content.replace(new RegExp(key, 'g'), value)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user