1.1.0 • Published 1 year ago

ztt-tools v1.1.0

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

安装

npm install ztt-tools

导入

const ztt = require('ztt-tools')

格式化时间

const dtStr = ztt.dateFormat(new Date())
console.log(dtStr)

转义 HTML 中的特殊字符

// 待转换的 HTML 字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
// 调用 htmlEscape方法进行转换
const str = ztt.htmlEscape(htmlStr);
console.log(str)

还原 HTML 中的特殊字符

// 待还原的 HTML 字符串
// 调用 htmlUnEscape方法进行还原
const hstr = ztt.htmlUnEscape(str);
console.log(hstr)

开源协议

ISC

1.1.0

1 year ago

1.0.2

2 years ago

1.0.0

2 years ago