New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ly-node-utils

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

ly-node-utils

格式化日期 html特殊字符转换

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

1.安装

npm install ly-node-utils

2.导入

const utils=require("ly-node-utils")

3.API

3.1 日期格式化

const dd =  utils.dataFormater(new Date())     
//打印 yyyy-MM-dd HH:mm:ss
console.log(dd)

3.2 html字符转换为转义字符

let str =  '<h1 style="color:red;">你好!&copy<span>小黄</span></h1>'
let str2 = utils.htmlEscape(str)  
//打印:&lt;h1 style=&quot;color:red;&quot;&gt;你好!&amp;copy&lt;span&gt;小黄&lt;/span&gt;&lt;/h1&gt;
console.log(str2)

3.3 转义字符转换为html字符

let str = '&lt;h1 style=&quot;color:red;&quot;&gt;你好!&amp;copy&lt;span&gt;小黄&lt;/span&gt;&lt;/h1&gt;'
let str2 = utils.htmlUnEscape(str)
//打印:<h1 style="color:red;">你好!&copy<span>小黄</span></h1>
console.log(str2)

4.开源协议

ISC

Keywords

ly

FAQs

Package last updated on 22 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts