当前位置:网站首页>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
}
边栏推荐
- AKK菌——下一代有益菌
- 1-21 jsonp interface
- Ten security measures against unauthorized access attacks
- asp. Net core JWT delivery
- Encryption and decryption and the application of OpenSSL
- 你我他是谁
- Two skylines
- 1-13 express监听GET和POST请求&处理请求
- [grade evaluator] how to register a grade evaluator? How many passes?
- 1-7 path module
猜你喜欢

本地浏览器打开远程服务器上的Jupyter Notebook/Lab以及常见问题&设置

Multi table operation - foreign key constraint

Spatiotemporal data mining: an overview

Dm8: generate DM AWR Report
Understand what MySQL index push down (ICP) is in one article

开源实习经验分享:openEuler软件包加固测试

興奮神經遞質——穀氨酸與大腦健康

Go build server Foundation

Four Misunderstandings of Internet Marketing

Introduction of 3D Max fine model obj model into ArcGIS pro (II) key points supplement
随机推荐
qsort函数和模拟实现qsort函数
1-16 路由的概念
银行集体下架的智能投顾产品,为何成了“鸡肋”?
A group of K inverted linked lists
Electronic scheme development - Intelligent rope skipping scheme
的撒啊苏丹看老司机
What about degradation of text generation model? Simctg tells you the answer
本地浏览器打开远程服务器上的Jupyter Notebook/Lab以及常见问题&设置
sdfsdf
Open source internship experience sharing: openeuler software package reinforcement test
升级kube出现unknown flag: --network-plugin
Who are you and I
代码改变一小步,思维跨越一大步
1-1 basic concepts of database
攻防演练中的防泄露全家福
Double solid histogram / double y-axis
1-20 预检请求
Can flinksql two Kafka streams join?
Upgrade Kube with unknown flag: --network plugin
《ClickHouse原理解析与应用实践》读书笔记(2)