mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
18 lines
369 B
JavaScript
Executable File
18 lines
369 B
JavaScript
Executable File
const div = document.createElement("div")
|
|
|
|
const tagReplacement = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
"'": ''',
|
|
'"': '"'
|
|
}
|
|
|
|
function sanitizeText(value) {
|
|
if (value.constructor === String) {
|
|
return value.replace(/[&<>'"]/g, tag => tagReplacement[tag])
|
|
}
|
|
return value
|
|
}
|
|
|
|
export default sanitizeText |