1.0.0 • Published 2 years ago

itheimazhou v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

导入

npm i itheimazhou

安装

const itheima =requeire('初始化itheima')

格式化时间

// 调用dataFormat
const Str= date.dataFormat(new Date)
// 结果 2022-05-23 16:11:51
console.log(Str)

转义html的特殊字符

// 带转换的HTML字符串
const arr = `<h1 title='abc'>这是h1标签<span>123&nbsp;</span></h1>`
// 调用html方法进行转换
const srt = date.html(arr)
// 结果 &lt;h1 title='abc'&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
console.log(srt)

还原html的特殊字符

// 待还原的html字符串
const srt2 = date.htmlStr(arr)
// 还原的结果<h1 title='abc'>这是h1标签<span>123&nbsp;</span></h1>
console.log(srt2)

还原协议

ISC