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

tyt-tools

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tyt-tools

```js npm install tyt-tools // 或者npm i tyt-tools ```

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

安装包

  npm install tyt-tools
  // 或者npm i tyt-tools

功能

实现时间格式化 、html 转义特殊字符串、以及 html 还原特殊字符串功能

时间格式化

//导入包
const date = require('./tyt-tools');
//调用dateForm方法
let dt = date.dateForm(new Date());
console.log(dt);
//输出结果 2023-03-27 15:16:16

html 转义特殊字符

//导入包
const htmlEscape = require('./tyt-tools');
//定义字符串
let html = `<h1>这是测试数据"&</h1>`;
//调用htmlEscape方法
let htmlStr = htmlEscape.htmlEscape(html);
console.log(htmlStr);
//输出结果 &lt;h1&gt;这是测试数据&quot;&amp;&lt;\h1&gt;

html 还原转义特殊字符

//导入包
const htmlEscape = require('./tyt-tools');
//定义字符串
let htmlStr = `&lt;h1&gt;这是测试数据&quot;&amp;&lt;\h1&gt;`;
//调用htmlUnEscape方法
let html2 = htmlEscape.htmlUnEscape(htmlStr);
console.log(html2);
//输出结果 <h1>这是测试数据"&</h1>

协议

ISC

Keywords

escape

FAQs

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