1.0.0 • Published 1 year ago

mff-utils v1.0.0

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

安装

、、、 npm install mff-utils 、、、

导入

、、、 const mffUtils = require("mff-utils") 、、、

格式化时间

、、、js // 调用 dateFormat 对时间进行格式化 const dtStr = mffUtils.dateFormat(new Date()) // 结果 2024-07-17 15:30:00 console.log(dtStr) 、、、

转义 HTML 中的特殊字符

、、、js // 待转换的字符串 const htmlStr = 'h1标签测试666 ' // 调用 htmlEscape 方法进行转换 const str = mffUtils.htmlEscape(htmlStr) //输出结果 <h1 title="abc">h1标签测试<span>666&nbsp;</span></h1> console.log(str); 、、、

1.0.0

1 year ago