1.0.0 • Published 3 years ago
yuy-tools v1.0.0
install
npm install yy-toolsimport
const yy = require('yy')date formatting
// call dateFormat to format the date
const dateStr = yy.dateFormat(new Date())
console.log(dateStr)Escape special characters in html
// The html string to be converted
const htmlStr = '<h1 title = "abc"> <span>123 </span> </h1>'
// call htmlEscape to escape
const afterEscape = yy.htmlEscape(htmlStr)
// escape result : <h1 title = "abc"> <span>123&nbsp;</span> </h1>
console.log(afterEscape)Unescape special characters in html
const unEscapeHtml = yy.htmlUnEscape(afterEscape)
// result : <h1 title = "abc"> <span>123 </span> </h1>
console.log(unEscapeHtml)Open Source Protocols
ISC
1.0.0
3 years ago