itheima-tools-xiaoj

1.0.0 • Public • Published
npm install itheima-tools
或者
npm i itheima-tools
const itheima = require('itheima-tools')
// 调用daraFormat ,对时间进行格式化
const dtStr = itheima.daraFormat(new Date())
// 打印输出结果
console.log(dtStr);
// 待转换的HTML字符串
const STR = '<h1 title="标签">123<span>abc</span></h1>'
// 调用htmlEscape方法,进行转换
const hep = itheima.htmlEscape(STR)
// 转换后的结果 &lt;h1 title=&quot;标签&quot;&gt;123&lt;span&gt;abc&lt;/span&gt;&lt;/h1&gt;
console.log(hep);
// 待还原的特殊字符串
const STR2 = '<h1>&lt;&gt;&lt;&gt;<span>abc&amp</span></h1>'
// 调用htmlUnEscape方法,进行还原
const hep2 = itheima.htmlUnEscape(STR2)
// 还原后的代码<h1><><><span>abc&amp</span></h1>
console.log(hep2);

ISC

/itheima-tools-xiaoj/

    Package Sidebar

    Install

    npm i itheima-tools-xiaoj

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    1.54 kB

    Total Files

    3

    Last publish

    Collaborators

    • 12xiaoj