xmlchars

中文文档
2.2.0发布于 2019/09/07MITTypeScriptCommonJS零依赖近 30 天下载 4.1亿

Utilities for determining if characters belong to character classes defined by the XML specs.

原始使用文档

Utilities for determining whether characters belong to character classes defined by the XML specs.

Organization

It used to be that the library was contained in a single file and you could just import/require/what-have-you the xmlchars module. However, that setup did not work well for people who cared about code optimization. Importing xmlchars meant importing all of the library and because of the way the code was generated there was no way to shake the resulting code tree.

Different modules cover different standards. At the time this documentation was last updated, we had:

  • xmlchars/xml/1.0/ed5 which covers XML 1.0 edition 5.
  • xmlchars/xml/1.0/ed4 which covers XML 1.0 edition 4.
  • xmlchars/xml/1.1/ed2 which covers XML 1.0 edition 2.
  • xmlchars/xmlns/1.0/ed3 which covers XML Namespaces 1.0 edition 3.

Features

The "things" each module contains can be categorized as follows:

  1. "Fragments": these are parts and pieces of regular expressions that correspond to the productions defined in the standard that the module covers. You'd use these to build regular expressions.

  2. Regular expressions that correspond to the productions defined in the standard that the module covers.

  3. Lists: these are arrays of characters that correspond to the productions.

  4. Functions that test code points to verify whether they fit a production.

版本与发布记录

xmlchars 共发布 10 个版本,首次发布于 2018/07/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.2.0latest2019/09/077 年前
2.1.12019/06/257 年前
2.1.02019/06/257 年前
2.0.12019/06/247 年前
2.0.02019/06/247 年前
1.3.12018/10/018 年前

关于 xmlchars 的常见问题

xmlchars 是什么?

Utilities for determining if characters belong to character classes defined by the XML specs.

如何安装 xmlchars?

在项目目录运行 npm install xmlchars,或使用 pnpm add / yarn add / bun add。

xmlchars 支持 TypeScript 吗?

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

xmlchars 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

xmlchars 可以商用吗?

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

xmlchars 的下载量有多少?

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

xmlchars 还在维护吗?

最新版本 2.2.0 发布于 2019/09/07(7 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/07/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。