1.0.0 • Published 3 years ago

npmpackage2022 v1.0.0

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

npm install npmpackage2022

import

const npkage = require('npmpackage2022')

formate datetime

// invoke dateFormat to format date
const dtStr = npkage.dateFormat(new Date())
// result  2020-04-03 17:20:58
console.log(dtStr)

Escaping special characters in HTML

// HTML strings with conversions
const htmlStr = '<h1 title="abc">this is h1 tag<span>123&nbsp;</span></h1>'
// Call the htmlEscape method for conversion
const str = dtStr.htmlEscape(htmlStr)
// result &lt;h1 title=&quot;abc&quot;&gt;this is h1 tag &lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
console.log(str)

Restore special characters to HTML

// Restore special characters to HTML
const str2 = dtStr.htmlUnEscape(str)
// result <h1 title="abc">this is h1 tag<span>123&nbsp;</span></h1>
console.log(str2)

Open Source Protocols

ISC