yongying-tools
v1.0.0
Published
提供格式化时间, HTMLEscape特殊字符转换等功能
Downloads
120
Maintainers
Readme
安装
npm install yongying-tools导入
const yongying = require("./yongying-tools");格式化时间
// 格式化时间的功能
const dtSTr = yongying.dateFormat(new Date());
// 结果 2026-06-08 10:20:31
console.log(dtSTr);转译 HTML 中特殊字符
// 转义 HTML 字符的功能
const htmlStr = '<h1> Hello & welcome to "yongying" </h1>';
const str = yongying.htmlEscape(htmlStr);
// 结果 <h1> Hello & welcome to "yongying" </h1>
console.log(str);还原 HTML 中的特殊字符
// 还原 HTML 字符的功能
const str2 = yongying.htmlUnEscape(str);
// 结果 <h1> Hello & welcome to "yongying" </h1>
console.log(str2);开源协议
ISC
