1.0.0 • Published 5 years ago

itheima-script v1.0.0

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

itheima-script使用说明文档

安装

npm itheima-script

导入方式

const itheima = require('itheima-script')

格式化时间

const temp = itheima.format(new Date())
console.log(temp)	//打印结果为:    "2020-03-06 20:02:30"
format()方法的参数是时间,返回值是"XXXX-XX-XX XX:XX:XX"格式的字符串。

转义HTML中的特殊字符

const initData = '<h1 style="color:red"> 哈喽 </h1>'	//准备要转换的HTML数据
const endData = itheima.HTMLScape(initData)			//调用HTMLEscape进行转换
console.log(endData)				//输出:&lt;h1 style="color:red"&rt; 哈喽....  

还原HTML中的特殊

调用HTMLUnscpe()函数,用法与上面类似。
1.0.0

5 years ago