improved error handling

This commit is contained in:
zadam
2023-09-21 11:16:03 +02:00
parent 5dd6f49104
commit bb81f110dd
6 changed files with 62 additions and 55 deletions

View File

@@ -895,6 +895,10 @@ async function asyncPostProcessContent(note, content) {
// all keys should be replaced by the corresponding values
function replaceByMap(str, mapObj) {
if (!mapObj) {
return str;
}
const re = new RegExp(Object.keys(mapObj).join("|"),"g");
return str.replace(re, matched => mapObj[matched]);