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

itin-tools

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itin-tools

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

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

安装

npm install itin-tools

导入

const tool = require("itin-tools");

格式化时间

//调用dateForm 对时间进行格式操作
const dt = tool.dateForm(new Date());
//结果 2022-08-31 15:39:51
console.log(dt);

转义 HTML 中特殊字符的方法

//定义待转换的HTML字符串
const html = '<h1 title="bac">这是一个段落<span>你好&nbsp</span></h1>';
//调用htmlEscap 进行转义
const ht = tool.htmlEscap(html);
//转换的结果 &lth1 title=&quotbac&quot&gt这是一个段落&ltspan&gt你好&ampnbsp&lt/span&gt&lt/h1&gt
console.log(ht);

还原 HTML 特殊字符串

//调用HTMLEScape 进行转换
//待还原的HTML字符串
const htmlStr = tool.HTMLEScape(ht);
//转换的结果 <h1 title="bac">这是一个段落<span>你好&nbsp</span></h1>
console.log(htmlStr);

开源协议

ISC

Keywords

it

FAQs

Package last updated on 31 Aug 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