Fix empty content (fix #4629)

This commit is contained in:
the1812 2024-02-12 23:28:09 +08:00
parent cc0bc33be3
commit bdf7cb7dba

View File

@ -7,6 +7,9 @@ const normalizeMap = {
}
const escapeMap = Object.fromEntries(Object.entries(normalizeMap).map(entry => entry.reverse()))
const replace = (content: string, map: Record<string, string>) => {
if (!content) {
return ''
}
for (const [key, value] of Object.entries(map)) {
content = content.replace(new RegExp(key, 'g'), value)
}