1.1.0 • Published 1 year ago

itheima-tools-zlf v1.1.0

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

安装

npm install itheima-tools-zlf

导入

js
const itheima = require('itheima-tools-zlf')

格式化时间

const newtime = require('./itheima-tools-zlf')
const times = newtime.formatDate(new Date())
console.log(times)

转义 Html 特殊字符

//待转换html字符串
const htmlstr = '<div title="box">hello world<span>你好啊&nbsp</span></div>';
//调用htmlEscape方法
const newHtml = htmls.htmlEscape(htmlstr);
console.log(newHtml, "字符");
// 结果  &lt;div title=&quot;box&quot;&gt;hello world&lt;span&gt;你好啊&amp;nbsp&lt;/span&gt;&lt;/div&gt;

反转义

const hhh = htmls.htmlUnEscape(nweHTMLL);
console.log(hhh, "反转义");

开源协议

ISC

1.1.0

1 year ago

1.0.0

3 years ago