xiaoyao-one
v1.0.0
Published
提供了格式化时间、HTMLEscape相关功能
Readme
工具包 提供格式化日期、HTML特殊字符转义/还原的功能。
安装
npm install xiaoyao-one导入
const xiaoyao = require('xiaoyao-one');##格式化时间
// 示例:格式化当前时间
const currentTime = new Date().toString();
const formattedTime = xiaoyao.dateFormat(currentTime);
console.log(formattedTime);
// 输出示例:2025-11-26 15:30:00
// 原始HTML内容 const originHtml = 'Hello & World';
// 转义(安全处理) const safeHtml = first.htmlEscape(originHtml); console.log(safeHtml); // 输出:<div class="content">Hello & World</div>
// 还原(恢复原始内容) const backHtml = first.htmlUnEscape(safeHtml); console.log(backHtml); // 输出:Hello & World
