当前位置:网站首页>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
}
边栏推荐
- Export El table as is to excel table
- ca i啊几次哦啊句iu家哦11111
- Open source internship experience sharing: openeuler software package reinforcement test
- Reading notes of Clickhouse principle analysis and Application Practice (3)
- 多态在代码中的体现
- 1-12 初步认识Express
- Reading notes of Clickhouse principle analysis and Application Practice (2)
- 12345
- CA I ah, how many times Oh, ah sentence IU home Oh 11111
- FreeRTOS record (IX. an example of a bare metal project transferring to FreeRTOS)
猜你喜欢

个人开发的渗透测试工具Satania

Reading notes of Clickhouse principle analysis and Application Practice (1)

Dm8: generate DM AWR Report

asp. Net core JWT delivery

Et la dégradation du modèle de génération de texte? Simctg vous donne la réponse

网络营销之四大误解

ICLR'22 Spotlight | 怎样度量神经网络权重中的信息量?
测试媒资缓存问题

jupyter notebook/lab 切换conda环境

clickhouse原生監控項,系統錶描述
随机推荐
sdfsdf
ca i啊几次哦啊句iu家哦11111
笔记【JUC包以及Future介绍】
激发新动能 多地发力数字经济
1-17 express中间件
Flutter 嵌套地狱?不存在的,ConstraintLayout 来解救!
1-2 安装并配置MySQL相关的软件
1-14 express托管静态资源
What happens when word encounters an error while trying to open a file?
How to run jenkins build, in multiple servers with ssh-key
NCAT detailed introduction (Reprint)
SQL server extracts pure numbers from strings
1-7 path module
asp.net core JWT传递
CA I ah, several times Oh, ah, a sentence IU home Oh
Double solid histogram / double y-axis
Random talk about Clickhouse join
电子方案开发——智能跳绳方案
Internet of things botnet gafgyt family and backdoor vulnerability exploitation of Internet of things devices
Dm8: generate DM AWR Report