0
点赞
收藏
分享

微信扫一扫

xss 转义

12a597c01003 2022-12-10 阅读 209

export const funEncodeHTML = function (str) {
if (typeof str === 'string') {
return str.replace(/<|&|>/g, (matches) => {
const res = ({
'<': '<',
'>': '>',
'&': '&',
})[matches];

return res ?? '';
});
}

return '';
};



举报

相关推荐

0 条评论