lyh-tools
v1.0.1
Published
提供了格式化时间,HTMLEscape相关的功能
Downloads
5
Readme
##安装
npm install lyh-tools
##导入
let lyh = require('lyh-tools')
##格式化时间
// 调用dateFormat方法对时间进行格式化
let lyhdate=lyh.dateFormat(new Date())
// 输出
console.log(lyhdate);
##转义html中的特殊字符
// 待转换的字符串
let htmlStr='<h1 title="abc">这是h1标签<span>123 </span></h1>'
// 调用htmlEscape方法进行转换
let str = lyh.htmlEscape(htmlStr)
// 输出
console.log(str);
##还原html中的特殊字符
// 待转换的字符串
let unhtmlStr='<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
let unstr=lyh.htmlUnEscape(unhtmlStr)
console.log(unstr);
##开源协议 ISC