itheima-tools-zlf

1.1.0 • Public • Published

安装

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

Package Sidebar

Install

npm i itheima-tools-zlf

Weekly Downloads

3

Version

1.1.0

License

ISC

Unpacked Size

2.39 kB

Total Files

5

Last publish

Collaborators

  • !zhanglingfeng