1.0.1 • Published 1 year ago

la-tools v1.0.1

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

李昂工具(LA-tools)安装

npm install la-tools

导入

const la = require('la-tools/index')

格式化时间

// 调用dateFormat() 对时间进行格式化
const dtStr = la.dateFormat(new Date())
console.log(dtStr)
// 结果 2024-01-05 14:14:00

转移HTML中的特殊字符

// 待转换的HTML字符串
const htmlStr = '<h1>这是h1标签<h1/>'
// 调用方法进行转换
const str = la.htmlEscape(htmlStr)
// 转换结果 &lth1&gt这是h1标签&lth1/&gt
console.log(str)

还原HTML中的特殊字符

// 待还原的HTML字符串
const newStr = la.htmlUnEscape(str)
// 转换结果 <h1>这是h1标签<h1/>
console.log(newStr)

开源协议

ISC

1.0.1

1 year ago

1.0.0

2 years ago