1.1.0 • Published 4 years ago
shiyi-tools v1.1.0
安装
npm install shiyi-tools
导入
const itheima = require("shiyi-tools");
格式化时间
// 调用 dateFormat 对时间进行格式化
const str = dt.dateFormat(new Date());
console.log(str);
转义 HTML 中的特殊字符
// 带转换的 HTML 字符串
const htmlStr =
'<h1 class="ico">我是一个标题<span>我是个span </span></h1>';
// 调用 htmlEscape 方法进行转换
const strs = dt.htmlEscape(htmlStr);
console.log(strs);
还原 HTML 中的特殊字符
// 待还原的 HTML 字符串
const strss = dt.htmlUnEscape(strs);
console.log(strss);
开源协议
ISC
1.1.0
4 years ago