1.0.0 • Published 1 year ago

mytry-tools v1.0.0

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

开源协议介绍 ##安装

npm install mytry-tools

##导入

const my=require('mytry-tools')

##格式化时间

//调用dateFormat 对时间进行格式化
const dtstr = my.dataFormat(new Date());
console.log(dtstr);

##转义HTML中的特殊字符

const htmlStr = '<h1 title="abc">这是一个h1标签<span>123&nbsp;</span></h1>';
const str = my.htmlEscape(htmlStr);
console.log(str);

##还原HTML 中的特殊字符

const UnStr = '&lt;h1 title=&quot;abc&quot;&gt;这是一个h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;'
const str2 = my.htmlUnEscape(UnStr);
console.log(str2);

##开源协议 ISC