1.0.1 • Published 2 years ago
npm-tools-tests v1.0.1
安装
npm install npm-tools-tests
引入
const npm_tools_tests = require('npm-tools-tests');
功能
格式化时间
//传入一个日期对象
let date = npm_tools_tests.dateFormat(new Date())
//结果 当前时间为:2022-08-01 18:37:38
console.log(date);
html转义
//传入一个带有html标签的字符
let str1 = npm_tools_tests.htmlEscape('<h2 class="aa">你好啊 </h2>')
//结果 <h2 class="aa">你好啊&nbsp;</h2>
console.log(str1);
html转义后还原
//传入一个已转义后的html字符
let str2 = npm_tools_tests.returnHtml('<h2 class="aa">你好啊&nbsp;</h2>')
//结果 <h2 class="aa">你好啊 </h2>
console.log(str2);
开源协议
ISC
1.0.1
2 years ago