my-yang
v1.0.0
Published
<!-- * @Author: yangmingwei0823 [email protected] * @Date: 2022-06-20 18:56:23 * @LastEditors: yangmingwei0823 [email protected] * @LastEditTime: 2022-06-20 20:27:59 * @FilePath: \数据可视化\10-node资料\day3\02.code\my-yang\README.md * @Description:
Downloads
5
Readme
安装
npm install my-yang
导入
//调用dataformat 对时间进行格式化
const dt = myang.dataformat(new Date())
//结果
console.log(dt)
转义 html中的特殊字符
// 待转换的html字符串
const htmlstr = '<h1 title="abc">这是h1标签<span>123 </span></h1>'
// 调用htmlescape 方法进行转换
const str = myang.htmlescape(htmlstr)
// 转换的结果为 <h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
还原 html中的特殊字符
//待还原的html字符串
const biaoqian1 = myang.htmlunescape(str)
// 输出的结果为<h1 title="abc">这是h1标签<span>123 </span></h1>
console.log(biaoqian1)
开源协议
ISC