export const funEncodeHTML = function (str) {
if (typeof str === 'string') {
return str.replace(/<|&|>/g, (matches) => {
const res = ({
'<': '<',
'>': '>',
'&': '&',
})[matches];
return res ?? '';
});
}
return '';
};
微信扫一扫
export const funEncodeHTML = function (str) {
if (typeof str === 'string') {
return str.replace(/<|&|>/g, (matches) => {
const res = ({
'<': '<',
'>': '>',
'&': '&',
})[matches];
return res ?? '';
});
}
return '';
};
相关推荐