1.0.0 • Published 2 years ago
custem_node v1.0.0
1.安装方式
1.1使用npm安装方式
npm i custom_node
2.导入方式
const c=require("custom_node")
3.格式化时间
function dateFormat(){
const date=new Date()
const y=date.getFullYear()
const m=date.getMonth()+1
const d=date.getDay()
const hh=date.getHours()
const mm=date.getMinutes()
const ss=date.getSeconds()
console.log(y+"-"+m+"-"+d+" "+hh+":"+mm+":"+ss)
}
4.转义TTML中的特殊字符
function htmlEscape(str){
const s=str.replace(/ >||<||" /g,(i)=>{
switch(i){
case ">":
return ">"
case "<":
return "<"
case '"':
return """
}
})
console.log(s)
}
5.还原HTML中的特殊字符
function htmlunEscape(str){
const a=str.replace(/ >|<|" /g,(i)=>{
switch(i){
case ">":
return "<"
case "<":
return ">"
case """:
return '"'
}
})
console.log(a)
}
6.开源协议
Isc
1.0.0
2 years ago