1.0.6 • Published 1 year ago

ccbfirstnpm v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

安装

npm install ccbfirstnpm

导入

const ccbfirstnpm = require('ccbfirstnpm')

格式化时间

//调用 dateFormat 函数对时间进行格式化
const str = ccbfirstnpm.dateformat(new Date())
// 结果 得到当前的时间  年-月-日 时-分-秒
console.log(str)

转义 HTML 中的特殊字符

//待转换的HTML字符串
cosnt htmlStr='<h1 title="abc">哈哈哈<span>嘿嘿&nbsp;</span></h1>'
调用 htmlEscape 函数转换html特殊字符
const str = ccbFirstnpm.htmlEscape(htmlstr)
// 结果 '&it;h1 title=&quot;abc&quot;&gt;哈哈哈&it;span&gt;嘿嘿&amp;nbsp;&it;/span&gt;&it;/h1&gt;'
console.log(str);

还原 HTML 中的特殊字符

//待还原的HTML字符串
cosnt htmlStr='&it;h1 title=&quot;abc&quot;&gt;哈哈哈&it;span&gt;嘿嘿&amp;nbsp;&it;/span&gt;&it;/h1&gt;'
调用 htmlUnEscape 函数还原html特殊字符
const str = ccbFirstnpm.htmlUnEscape(htmlstr)
// 结果 '<h1 title="abc">哈哈哈<span>嘿嘿&nbsp;</span></h1>'
console.log(str);

开源协议

ISC
1.0.6

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago