format-html
v1.0.0
Published
格式化html
Downloads
19
Maintainers
Readme
安装
npm install formatHtmlTools
使用-格式化html
const dataFormatTools = require('./index.js');
const html = `
<div>
<h1>hello && world</h1>
<p>hello world</p>
</div>
`
const htmlStrFormat = dataFormatTools.htmlFormat(htmlStr);
//将字符串中的html标签进行转义,防止xss攻击
//同时也可以解析html中的转义字符
const htmlStoreStr = dataFormatTools.htmlRestore(htmlStrFormat);
使用-格式化时间
const dataFormatTools = require('./index.js');
const str = dataFormatTools.dataFormat(new Date());
开源协议
ISC