mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
add escape
This commit is contained in:
1 parent
e2193c7aa9
commit
43f68a3b68
4 files changed
+31
-5
No files matched your search
@@ -9,3 +9,17 @@ export function secondToTime(second) {
|
||||
const sec = Math.floor(second - hour * 3600 - min * 60);
|
||||
return (hour > 0 ? [hour, min, sec] : [min, sec]).map(add0).join(':');
|
||||
}
|
||||
|
||||
export function escape(str) {
|
||||
return str.replace(
|
||||
/[&<>'"]/g,
|
||||
tag =>
|
||||
({
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
"'": ''',
|
||||
'"': '"',
|
||||
}[tag] || tag),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user