Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

17-itheima-tools-ceshiceshi

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

17-itheima-tools-ceshiceshi

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

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

安装

npm install 17-itheima-tools-ceshiceshi

导入

const itheima = require('17-itheima-tools-ceshiceshi')

格式化时间

const dt = itheima.dateFormat(new Date())
console.log('格式化后的时间:', dt);

转义 HTML 中的特殊字符

// 待转换的 HTML 字符串
const htmlStr = '<h1 style="color:red;">你好, &copy;<span>小黄!</span></h1>'
// 调用 htmlEscape 方法进行转换
const str = itheima.htmlEscape(htmlStr)
console.log('转义后的字符:', str);

还原 HTML 中的特殊字符

const htmlUn = itheima.htmlUnEscape(str)
console.log('还原特殊字符串后的HTML:', htmlUn);

开源协议

ISC

Keywords

17-itheima-tools-ceshiceshi

FAQs

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