UNPKG
xi-2022
Version:
latest (1.0.0)
1.0.0
提供了格式化时间、HTMLEscape相关的功能
xi-2022
/
src
/
zy.js
20 lines
(19 loc)
•
502 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 转义
function
zy
(
html
){
if
(
typeof
html===
'string'
){
return
html.
replace
(
/<|>|&|"/g
,
m
=>
{
switch
(m){
case
'<'
:
return
'<'
case
'>'
:
return
'>'
case
'&'
:
return
'&'
case
'"'
:
return
'"'
} })}
else
{
return
'请输入字符串'
}}
module
.
exports
={ zy }