1.0.4 • Published 1 year ago

ithe-too v1.0.4

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

安装

npm install ithe-too

导入

const itheima = require('ithe-too')

格式化时间

// 调用dataformat 对事件进行格式化
const dtStr = itheima.dataFormat(new Date())
// 结果:2023-02-13 10:30:39  
console.log(dtStr);

转义html中的特殊字符

// 待转换的html字符串
const htmlstr = '<h1>这十一个h1标签<span>123&nbsp;</span></h1>'
const str = itheima.htmlEscape(htmlstr)
// 结果是:&lt;h1&gt;这十一个h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
console.log(str);

还原html特殊字符的用法

// 待还原的html字符串
const htmls = itheima.htmlUnescape(str)
// 输出的结果:<h1>这十一个h1标签<span>123&nbsp;</span></h1>
console.log(htmls)
1.0.4

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago