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

itzyj-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

itzyj-utils

提供了格式化时间,HTMLEscape的功能

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

安装


npm install itzyj-tools

导入


const itzyj = require('itzyj-utils')

格式化时间

// 调用 dateFormat 对时间进行格式化

const dtStr = itzyj.dateFormat(new Data())

console.log(dtStr)

// 结果 2022-7-30 17:37:58

转义 HTML 中的特殊字符

// 待转换的 HTML 字符串

const htmlStr = '<h1 title="标题">首页<span>123&npsp;</span></h1>'

// 调用 htmlEscape 方法进行转换

const str = itzyj.htmlEscape(htmlStr)

// 转换的结果 &lt;h1 title=&quot;标题&quot;&gt;首页&lt;span&gt;123&amp;npsp;&lt;/span&gt;&lt;/h1&gt;

还原 HTML 中的特殊字符

// 待还原的HTML 字符串
 
const str2 = itzyj.htmlUnEscape(str)

console.log(str2)

// 输出的结果 <h1 title="标题">首页<span>123&npsp;</span></h1>

开源协议

ISC

Keywords

itzyj

FAQs

Package last updated on 30 Jul 2022

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