1.0.0 • Published 3 years ago

itheima-tools-empty v1.0.0

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

install

npm install itheima-tools-zx

import

const itheima = require('itheima-tools-zx');

format date

//invoke dateFormat to format date
const dtStr = itheima.dataFormat(new Date());
console.log(dtStr);

转义html中的特殊字符

const htmlStr = '<h1 title="abc">this is h1 tag<span>123&nbsp;</span></h1>';
const str = itheima.htmlEscape(htmlStr);
console.log(str);

还原html中的特殊字符

const str2 = itheima.htmlUnEscape(str);
console.log(str2);

licence

ISC