1.0.0 • Published 2 years ago

hawkingl-util v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装

npm install hawkingl-util

导入

const util = require('hawkingl-util') 

格式化时间

// 调用 dateFormat 对时间进行格式化  
const dtStr = util.dateFormat(new Date())
// 返回值  YYYY-MM-DD HH:MM:SS
console.log(dtStr);

转义html

const htmlStr = '<h1 title="abc">这里是h1标签</h1>';
const str = unlit.htmlEscape(htmlStr);
// 返回值  字符串
console.log(str);

还原html

const str = '&lt;h1 title=&quot;abc&quot;&gt;这里是h1标签&lt;/h1&gt;'
const htmlStr1 = unlit.htmlUnEscape(str);
// 返回值  html标签
console.log(htmlStr1);

开源协议

ISC