ityangxin-plays

1.0.0 • Public • Published

##安装保姆及教程

npm install ityangxin-plays

##导入

const ityangxin = require('ityangxin-plays');

##格式化时间

//调用dateFormat 对时间进行格式化
const dtStr = ityangxin.dateFormat(new Date());
//结果 2022-5-14 11:37:00
console.log(dtStr);

##转义HTML中的特殊字符

//带转换的htmlEscape方法进行转换
const htmlstr = '<h1 title="猛虎王">这tm是h1标签<span>暴风星云裂</span></h1>'
const str = ityangxin.htmlEscape(htmlstr);
//转换的结果 &lt;h1 title=&quot;猛虎王&quot;&gt;这tm是h1标签&lt;span&gt;暴风星云裂&lt;/span&gt;&lt;/h1&gt;
console.log(str);

##还原HTML中的特殊字符

const str2 = ityangxin.htmlUnEscape(str);
//输出的结果 <h1 title="猛虎王">这tm是h1标签<span>暴风星云裂</span></h1>
console.log(str2)

##开源协议 ISC

Package Sidebar

Install

npm i ityangxin-plays

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

2.77 kB

Total Files

5

Last publish

Collaborators

  • kiro_an