1.0.0 • Published 1 year ago

yuy-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

install

npm install yy-tools

import

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&nbsp;</span> </h1>'
// call htmlEscape to escape
const afterEscape = yy.htmlEscape(htmlStr)
// escape result : &lt;h1 title = &quot;abc&quot;&gt; &lt;span&gt;123&amp;nbsp;&lt;/span&gt; &lt;/h1&gt;
console.log(afterEscape)

Unescape special characters in html

const unEscapeHtml = yy.htmlUnEscape(afterEscape)
// result : <h1 title = "abc"> <span>123&nbsp;</span> </h1>
console.log(unEscapeHtml)

Open Source Protocols

ISC

1.0.0

1 year ago