1
0
mirror of https://github.com/renbaoshuo/UOJ-Luogu-RemoteJudge.git synced 2024-12-29 00:51:59 +00:00
UOJ-Luogu-RemoteJudge/luogu_remote_judger/utils/htmlspecialchars.js

12 lines
211 B
JavaScript
Raw Normal View History

2023-03-21 11:14:43 +00:00
export default function htmlspecialchars(text) {
const map = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;',
};
return text.replace(/[&<>"']/g, m => map[m]);
}