textformatts
v1.0.0
Published
提供了格式化时间、HTMLEscape相关的功能
Downloads
4
Maintainers
Readme
安装
npm install textformatts
导入
const textformatts = require('textformatts')
格式化时间
// 调用dateFormat 对时间进行格式化
const dtStr = textformatts.dateFormat(new Date())
console.log(dtStr)
转义HTML中的特殊字符
// 调用htmlEscape 对HTML中的特殊字符进行转义
const htmlStr = textformatts.htmlEscape('<h1>你好</h1>')
console.log(htmlStr)
还原html特殊字符
// 调用htmlUnEscape 对HTML中的特殊字符进行还原
const str = textformatts.htmlUnEscape(htmlStr)
console.log(str)
开源协议
ISC