New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

laity

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

laity

提供了格式化时间、HTMLEscape相关的功能

unpublished
latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

安装

npm install laity

导入

const pkg=require("laity")

格式化时间

//调用dateFormat对时间进行格式化
const dtStr = pkg.dateFormat(new Date())
//结果 2022-05-22 12:25:48
console.log(dtStr)

转义html特殊字符

//带转换的HTML字符
const htmlStr = '<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>'
//调用对应的方法
const str = pkg.htmlEscape(htmlStr);
//转换的结果 &lt;h1 title=&quot;abc&quot;&gt;这是h1标签&lt;span&gt;123&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
console.log(str)

还原HTML中的特殊字符

//带还原的字符串
const unStr = pkg.htmlUnEscape(str);
//输出的结果<h1 title="abc">这是h1标签<span>123&nbsp;</span></h1>
console.log(unStr);

开源协议

ISC

Keywords

dateFormat

FAQs

Package last updated on 22 May 2022

Related posts