# @favware/unescape 中文文档

规范地址：https://npmcn.com/package/%40favware/unescape/

版本：1\.3\.2
npm 元数据更新时间：2022-04-05T10:22:26.643Z
中文译文更新时间：2026-11-14T12:19:39.975Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40favware/unescape
原文对照：https://npmcn.com/package/%40favware/unescape/?lang=original
项目主页：https://github.com/favware/node-packages/tree/master/packages/unescape#readme
源码仓库：https://github.com/favware/node-packages

弃用说明：Work on this package has stopped in favor of confusables \(https://www\.npmjs\.com/package/confusables\) from developer gc \(https://github\.com/gc\), a package which I have also contributed to and has a much better feature set and far better performance

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：23.8 kB，12 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=10
- 运行依赖：0 个
- 首次发布：2019-05-18T14:26:49.106Z
- 最新版本发布：2020-01-22T21:50:35.334Z
- 近 30 天下载量：2573（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：12（近 12 个月 0 个）

## 中文简介

将 HTML 实体转换为 HTML 字符, 例如 . `&gt;` 转换为 `>`。 。 。 .

## 安装

```sh
npm install @favware/unescape
```

也可以使用：`pnpm add @favware/unescape`、`yarn add @favware/unescape`、`bun add @favware/unescape`

## README

# **_被否决_**

这个套件的工作已经停止了 有利于 [用户](https://www.npmjs.com/package/confusables) 从开发者 [(单位:千美元)](https://github.com/gc),一个我也有贡献的套件, 并且有更好的特点集 和更好的业绩

* * *

[![logo](https://storage.googleapis.com/data-sunlight-146313.appspot.com/website-project-icons/unescape.png)](https://favware.tech/unescape)

# @ favware/ unascape (帮助)

### 将 HTML 实体转换为 HTML 字符, 例如 . `>` 转换为 `>`。 。 。 .

* * *

**项目状况**

[![GitHub](https://img.shields.io/github/license/favware/node-packages?logo=github&style=flat-square)](https://github.com/favware/node-packages/blob/master/LICENSE.md) [![Codecov](https://img.shields.io/codecov/c/github/favware/node-packages?logo=codecov&style=flat-square)](https://codecov.io/gh/favware/node-packages)

**套装大小**

[![npm bundle size](https://img.shields.io/bundlephobia/min/@favware/unescape?label=unescape%20-%20minified&logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@favware/unescape) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@favware/unescape?label=unescape%20-%20minzipped&logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@favware/unescape) [![npm](https://img.shields.io/npm/v/@favware/unescape?color=crimson&label=unescape%20version&logo=npm&style=flat-square)](https://www.npmjs.com/package/@favware/unescape)

**社会媒体和捐助**

[![Join Discord server](https://img.shields.io/discord/512303595966824458?color=697EC4&label=Join%20Discord%20Server&logo=discord&logoColor=FDFEFE&style=flat-square)](https://favware.tech/redirect/server) [![Twitter Follow](https://img.shields.io/twitter/follow/favna_?label=Follow%20@Favna_&logo=twitter&colorB=1DA1F2&style=flat-square)](https://twitter.com/Favna_/follow) [![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&style=flat-square&link=https://www.patreon.com/bePatron?u=9336537)](https://www.patreon.com/bePatron?u=9336537) [![PayPal Donate](https://img.shields.io/badge/paypal-donate-brightgreen.svg?label=Donate%20with%20Paypal&logo=paypal&colorB=00457C&style=flat-square&link=https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMAYCF9SDHZ34)](https://www.patreon.com/bePatron?u=9336537)

* * *

后端和前端的 HTML 实体都很容易脱逃

**关键特性**

-   可以通过选择的软件包管理器在节点JS中使用
-   类型安全
-   与 Rollup 捆绑在一起, 用于最大缩小大小( 仅 1kB 更小 + gziped!), ES 模块支持和浏览器支持
-   生成类型脚本声明
-   在 Web 包装中可树摇动

# 安装

安装方式 [线条](https://yarnpkg.com/) 或者说 [无](https://www.npmjs.com/)数字 :

```sh
yarn add @favware/unescape

# npm install @favware/unescape
```

* * *

# 使用量

```js
const { unescape, charSets } = require('@favware/unescape');
// import unescape, { charSets } from '@favware/unescape';

const text = '&lt;div&gt;unescaped&lt;/div&gt;';

console.log(unescape('&lt;div&gt;abc&lt;/div&gt;'));
console.log(unescape`&lt;div&gt;abc&lt;/div&gt;`);
console.log(unescape`awesome text with some ${text} section`);

// Log the supported characters
console.log(charSets);
```

## [API 文档](https://favware.github.io/node-packages/modules/_favware_unescape.html)

## 常见问题

### @favware/unescape 是什么？

将 HTML 实体转换为 HTML 字符, 例如 \. &gt; 转换为 \>。 。 。 \.注意：该包已被作者标记为弃用——Work on this package has stopped in favor of confusables \(https://www\.npmjs\.com/package/confusables\) from developer gc \(https://github\.com/gc\), a package which I have also contributed to and has a much better feature set and far better performance

### 如何安装 @favware/unescape？

在项目目录运行 npm install @favware/unescape，或使用 pnpm add / yarn add / bun add。

### @favware/unescape 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @favware/unescape 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @favware/unescape 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=10。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @favware/unescape 可以商用吗？

@favware/unescape 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @favware/unescape 的下载量有多少？

根据 npm 官方下载统计，@favware/unescape 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,573 次，日均约 86 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @favware/unescape 还在维护吗？

最新版本 1\.3\.2 发布于 2020/01/23（6 年前）；至今共发布 12 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/05/18。作者已将其标记为弃用，新项目建议寻找替代方案。

