当前位置:网站首页>Develop your own package
Develop your own package
2022-06-30 21:30:00 【Endless pie】
Develop your own package
// Time escape
function dateFormat(dateStr){
const dt = new Date(dateStr)
const y = dt.getFullYear()
const m = padZero(dt.getMonth()+1)
const d = padZero(dt.getDay())
const hh = padZero(dt.getHours())
const mm = padZero(dt.getMinutes())
const ss = padZero(dt.getSeconds())
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
}
// Define a zero complement function
function padZero(n){
return n>9?n:'0'+n
}
// Define transfer html character
function htmlEscape(htmlStr){
return htmlStr.replace(/<|>|"|"&/g,(match)=>{
switch(match){
case '<':
return '<'
case '>':
return '>'
case '"':
return '"'
case '&':
return '&'
}
})
}
// Define restore html Function of
function htmlUnEscape(htmlStr){
return htmlStr.replace(/<|>|"|&/g,(match)=>{
switch(match){
case '<':
return '<'
case '>':
return '>'
case '"':
return '"'
case '&':
return '&'
}
})
}
module.exports={
dateFormat,
htmlEscape,
htmlUnEscape
}
边栏推荐
- 《ClickHouse原理解析与应用实践》读书笔记(1)
- 漫谈Clickhouse Join
- A group of K inverted linked lists
- Upgrade Kube with unknown flag: --network plugin
- USBCAN分析仪的配套CAN和CANFD综合测试软件LKMaster软件解决工程师CAN总线测试难题
- Who are you and I
- Internet of things botnet gafgyt family and backdoor vulnerability exploitation of Internet of things devices
- 用yml文件进行conda迁移环境时的报错小结
- 布隆过滤器
- twelve thousand three hundred and forty-five
猜你喜欢

Why have the intelligent investment advisory products collectively taken off the shelves of banks become "chicken ribs"?

银行集体下架的智能投顾产品,为何成了“鸡肋”?

What about degradation of text generation model? Simctg tells you the answer

Apply for vector bus protocol color picture wallpaper hanging picture, very good!

MySQL advanced 3

3Ds Max 精模obj模型导入ArcGIS Pro (二)要点补充

Dm8: generate DM AWR Report
Testing media cache

clickhouse原生監控項,系統錶描述

Neurotransmetteurs excitateurs - glutamate et santé cérébrale
随机推荐
ca i啊几次哦啊句iu家哦11111
興奮神經遞質——穀氨酸與大腦健康
clickhouse原生监控项,系统表描述
升级kube出现unknown flag: --network-plugin
pytorch geometric torch-scatter和torch-sparse安装报错问题解决
数字货币:影响深远的创新
代码改变一小步,思维跨越一大步
Reading notes of Clickhouse principle analysis and Application Practice (2)
测试媒资缓存问题
1-7 path module
.netcore redis GEO类型
用yml文件进行conda迁移环境时的报错小结
1-12 初步认识Express
将博客搬至CSDN
Test medal 1234
clickhouse原生監控項,系統錶描述
Text recognition svtr paper interpretation
The 16th Heilongjiang Provincial Collegiate Programming Contest
jupyterbook 清空控制台输出
Upgrade Kube with unknown flag: --network plugin