1.0.2 • Published 3 years ago

yawang_df v1.0.2

Weekly downloads
13
License
ISC
Repository
-
Last release
3 years ago

雅雅雅雅

雅望天堂~

安装

npm install yawang_df

导入

const yawang = require('yawang_df')

格式化时间

// 调用 dateFormat 对时间进行格式化
const dtStr = yawang.DateFormat(new Date())
// 结果  2021-01-07 19:16:50
console.log(dtStr)

转义 HTML 中的特殊字符

// 带转换的 HTML 字符串
const htmlStr = '<h1>这是我打的第一个"包"&"宝宝"</h1>'
// 调用 htmlEscape 方法进行转换
const str = yawang.htmlEscape(htmlStr)
// 转换的结果 &lt;h1&gt;这是我打的第一个%quot;包%quot;&amp;%quot;宝宝%quot;&lt;/h1&gt;
console.log(str)

还原 HTML 中的特殊字符

// 待还原的 HTML 字符串
const str2 = yawang.htmlUnescape(str)
// 输出的结果 '<h1>这是我打的第一个"包"&"宝宝"</h1>'
console.log(str2)

开源协议

ISC

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago