npm i custom_node_dyw
const c = require("custom_node_dyw")
function dataFormat(){
const date = new Date()
//月份从0开始
const y = date.getFullYear()
const m = date.getMonth()+1
const d = date.getDate()
const hh = date.getHours()
const mm = date.getMinutes()
const ss = date.getSeconds()
console.log(y+"年"+m+"月"+d+"日"+hh+"时"+mm+"分"+ss+"秒")
}
module.exports={
dataFormat
}
function htmlEscape(str){
const s = str.replace(/>|<|"/g,(i)=>{ // '/'开头 '/'结尾 g全局
switch(i){
case ">":
return ">"
case "<":
return "<"
case '"':
return """
}
})
console.log(s)
}
function htmlunEscape(str){
const s2 = str.replace(/>|<|"/g,(i)=>{
switch(i){
case ">":
return ">"
case "<":
return "<"
case '"':
return '"'
}
})
console.log(s2)
}
module.exports={
htmlEscape,htmlunEscape
}
ISC