1.0.2 • Published 5 years ago

istools v1.0.2

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

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)
 
// 输出结果 &lt;h1&gt;1&amp;2&amp;3&lt;/h1&gt;

HTML Unescape

// 待转换的 HTML 字符串
const unstr = '&lt;h1&gt;1&amp;2&amp;3&lt;/h1&gt;'

// 调用 htmlUnescape 进行转换
const unHtmlStr = istools.htmlUnescape(unstr)

//输出 console.log(unHtmlStr)
 
// 输出结果 <h1>1&2&3</h1>

License

npm.io

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago