1.0.0 • Published 1 year ago
format-diy v1.0.0
安装
npm install format-diy
导入
const formatDiy = require("format-diy");
格式化时间
const formatDiy = require("format-diy");
console.log(formatDiy.dateFormat(new Date()));
//输出格式化后的补零时间
HTML 的标签转义特殊字符
const formatDiy = require("format-diy");
const htmlStr = '<h1 style="color:red"> </h1>';
console.log(formatDiy.htmlEscape(htmlStr));
// 输出 <h1> style="color:red"< &nbsp; /h1>
还原转义过后的 HTML 标签字符串
const formatDiy = require("format-diy");
const htmlStr = "<h1> style="color:red"< &nbsp; /h1>";
console.log(formatDiy.htmlUnEscape(htmlStr));
//输出<h1 style="color:red"> </h1>
开源协议
ISC
1.0.0
1 year ago