1.0.0 • Published 1 year ago

time-looclsone v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

npm install time-looclsone

导入

const time = requrie('time-loocls') 

格式化时间

// 调用dateFormat对时间进行格式化
 const timer = time.dateFormat(new Date())
//  结果
 console.log(timer);

转义html中的特殊字符

// 定义了待转化的字符串
const htmlstr = '<h1>222</h1>'
// 调用HtmlEscapge方法进行转义
const result = time.HtmlEscapge(htmlstr)
// 输出结果
console.log(result);

还原html中的特殊字符

// 定义了待还原的字符串
const htmlstr = '<h1>222</h1>'
// 使用HtmlUnEscapge方法
const result1 = time.HtmlUnEscapge(htmlstr)
// 输出结果
console.log(result1)

开源协议

ISC