ly-tools-wh

1.0.1 • Public • Published

安装

npm install ly-tools-wh

导入

const ly = require('ly-tools-wh')

格式化时间

// 调用 dataFormat 对时间进行格式化
const newLY = ly.dateFormat(new Date());
// 结果
console.log('格式化时间: ', newLY);

转义 HTML 中的特殊字符

// 待转换的 HTML 字符串
const htmlStr = '<h1 title="abc">这是h1标签<span>&nbsp;</span></h1>'
// 调用 htmlEscap 方法进行转换
const str = ly.htmlEscape(htmlStr)
// 结果
console.log('转义 HTML 字符: ' + str);

还原 HTML 中的特殊字符

// 待还原的 HTML 字符串
const rawHTML = ly.htmlUnEscape(str);
console.log('还原 HTML 字符: '+ rawHTML);

开源协议

ISC

Bug修复版本1.0.1

// 解决了初期版本 包 名称和md文档说明内容不一致!

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i ly-tools-wh

      Weekly Downloads

      2

      Version

      1.0.1

      License

      ISC

      Unpacked Size

      2.78 kB

      Total Files

      5

      Last publish

      Collaborators

      • lyliu