当前位置:网站首页>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
}
边栏推荐
- ICLR'22 Spotlight | 怎样度量神经网络权重中的信息量?
- ArcGIS construction and release of simple road network data service and rest call test
- MySQL advanced 3
- Learning summary
- 元宇宙可能成为互联网发展的新方向
- ArcGIS构建发布简单路网Network数据服务及Rest调用测试
- Flutter 嵌套地狱?不存在的,ConstraintLayout 来解救!
- 1-12 preliminary understanding of Express
- A small step in code change and a big leap in thinking
- SQL server extracts pure numbers from strings
猜你喜欢

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

asp. Net core JWT delivery

Spatiotemporal data mining: an overview

clickhouse原生监控项,系统表描述

ICML2022 | 序列决策的效用理论

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

Oracle 数据库表结构 Excel 导出

Adobe Photoshop (PS) - script development - remove file bloated script

Clickhouse native monitoring item, system table description

时空数据挖掘:综述
随机推荐
布隆过滤器
Dm8: generate DM AWR Report
USBCAN分析仪的配套CAN和CANFD综合测试软件LKMaster软件解决工程师CAN总线测试难题
1-17 express中间件
针对美国国家安全局“酸狐狸”漏洞攻击武器平台的分析与应对方案建议
FreeRTOS record (IX. an example of a bare metal project transferring to FreeRTOS)
Fletter nested hell? No, constraintlayout to save!
Double solid histogram / double y-axis
ICLR'22 Spotlight | 怎样度量神经网络权重中的信息量?
Upgrade Kube with unknown flag: --network plugin
Random talk about Clickhouse join
1-7 path module
Understand what MySQL index push down (ICP) is in one article
文本生成模型退化怎么办?SimCTG 告诉你答案
开源实习经验分享:openEuler软件包加固测试
asp.net core JWT传递
What happens when word encounters an error while trying to open a file?
1-14 express托管静态资源
Icml2022 | utility theory of sequential decision making
Oprator-1 first acquaintance with oprator