1.0.2 • Published 5 years ago
istools v1.0.2
istools 1.0.2
Installation
npm istall istools
Using npm
const istools = require('istools')
Time Format
// 调用 dateFormat 进行时间格式化
const dt = istools.dateFormat(new Date())
输出
console.log(dt)
// 输出结果 2020-03-05 12:03:15
HTML Escape
// 待转换的 HTML 字符串
const str = "<h1>1&2&3</h1>"
// 调用 htmlEscape 进行转换
const htmlStr = istools.htmlEscape(str)
//输出 console.log(htmlStr)
// 输出结果 <h1>1&2&3</h1>
HTML Unescape
// 待转换的 HTML 字符串
const unstr = '<h1>1&2&3</h1>'
// 调用 htmlUnescape 进行转换
const unHtmlStr = istools.htmlUnescape(unstr)
//输出 console.log(unHtmlStr)
// 输出结果 <h1>1&2&3</h1>