# @dsherret/to-absolute-glob 中文文档

规范地址：https://npmcn.com/package/%40dsherret/to-absolute-glob/

版本：2\.0\.2
npm 元数据更新时间：2022-06-12T17:22:09.252Z
中文译文更新时间：2026-11-12T21:34:15.563Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40dsherret/to-absolute-glob
原文对照：https://npmcn.com/package/%40dsherret/to-absolute-glob/?lang=original
项目主页：https://github.com/jonschlinkert/to-absolute-glob
源码仓库：https://github.com/jonschlinkert/to-absolute-glob

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

- 包体积（解压后）：9 kB，4 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=0\.10\.0
- 运行依赖：2 个
- 首次发布：2018-03-07T21:11:45.613Z
- 最新版本发布：2018-03-07T21:11:45.930Z
- 近 30 天下载量：374775（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：1（近 12 个月 0 个）

## 中文简介

使平面图案绝对化,确保有后缀的负平面图案和图案得到正确处理.

## 安装

```sh
npm install @dsherret/to-absolute-glob
```

也可以使用：`pnpm add @dsherret/to-absolute-glob`、`yarn add @dsherret/to-absolute-glob`、`bun add @dsherret/to-absolute-glob`

## README

# 绝对的 - glob [![NPM version](https://img.shields.io/npm/v/to-absolute-glob.svg?style=flat)](https://www.npmjs.com/package/to-absolute-glob) [![NPM downloads](https://img.shields.io/npm/dm/to-absolute-glob.svg?style=flat)](https://npmjs.org/package/to-absolute-glob) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/to-absolute-glob.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/to-absolute-glob) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/to-absolute-glob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/to-absolute-glob)

> 使平面图案绝对化,确保有后缀的负平面图案和图案得到正确处理.

## 安装

安装方式 [无](https://www.npmjs.com/)数字 :

```sh
$ npm install --save to-absolute-glob
```

## 使用量

```js
var toAbsGlob = require('to-absolute-glob');
toAbsGlob('a/*.js');
//=> '/dev/foo/a/*.js'
```

## 实例

鉴于当前项目文件夹 (cwd) 是 `/dev/foo/`数字 :

**让路径绝对**

```js
toAbsGlob('a');
//=> '/dev/foo/a'
```

**使表白绝对**

```js
toAbsGlob('a/*.js');
//=> '/dev/foo/a/*.js'
```

**保留后缀**

```js
toAbsGlob('a/*/');
//=> '/dev/foo/a/*/'
```

**保留后缀为 cwd**

```js
toAbsGlob('./fixtures/whatsgoingon/*/', {cwd: __dirname});
//=> '/dev/foo/'
```

**使负光度绝对值**

```js
toAbsGlob('!a/*.js');
//=> '!/dev/foo/a/*.js'
```

**从 cwd**

```js
toAbsGlob('a/*.js', {cwd: 'foo'});
//=> '/dev/foo/foo/a/*.js'
```

**从 cwd 中得出负的绝对值**

```js
toAbsGlob('!a/*.js', {cwd: 'foo'});
//=> '!/dev/foo/foo/a/*.js'
```

**从根路径**

```js
toAbsGlob('/a/*.js', {root: 'baz'});
//=> '/dev/foo/baz/a/*.js'
```

**从根切起**

```js
toAbsGlob('/a/*.js', {root: '/'});
//=> '/dev/foo/a/*.js'
```

**从负根路径**

```js
toAbsGlob('!/a/*.js', {root: 'baz'});
//=> '!/dev/foo/baz/a/*.js'
```

**从负根斜切**

```js
toAbsGlob('!/a/*.js', {root: '/'});
//=> '!/dev/foo/a/*.js'
```

## 关于

### 相关项目

-   [已显示](https://www.npmjs.com/package/has-glob): 回归 `true` 如果一个阵列有一个光滑图案。 | [主页](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.")
-   [正在显示](https://www.npmjs.com/package/is-glob): 回归 `true` 如果给定的字符串看起来像是光彩图案或外形图案.. [更多](https://github.com/jonschlinkert/is-glob) | [主页](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
-   [正在验证- glob](https://www.npmjs.com/package/is-valid-glob): 如果一个值是有效的光彩图案或图案,则返回真值。 | [主页](https://github.com/jonschlinkert/is-valid-glob "Return true if a value is a valid glob pattern or patterns.")

### 捐款

拉出请求和星星总是受欢迎的. 对于错误和特性请求, [请创建一个问题](https://npmcn.com/package/issues/new)。 。 。 .

### 贡献者

| **提交** | **贡献者**  
| | -- -- -- -- -- -- -- 16个 [鸽子](https://github.com/doowb) | 15个 [扬施林克特](https://github.com/jonschlinkert) | | 1 | [发烧](https://github.com/phated) | | 1 | [电子计算机操作员](https://github.com/erikkemperman) |

### 大楼文件

_(此文档由 [动词基因读取器](https://github.com/verbose/verb-generate-readme) 联合国 [动词](https://github.com/verbose/verb) 发电机,请不要直接编辑读取器. 读取器的任何改动必须在 [动词 md](https://npmcn.com/package/%40dsherret/to-absolute-glob/.verb.md). ) (中文(简体) )_

生成 readme 和 API 文档 [动词](https://github.com/verbose/verb)数字 :

```sh
$ npm install -g verb verb-generate-readme && verb
```

### 正在测试

安装非依赖性 :

```sh
$ npm install -d && npm test
```

### 作者

**乔恩·斯林克特**

-   [千兆克/正弦链路](https://github.com/jonschlinkert)
-   [推特/简斯林克特](http://twitter.com/jonschlinkert)

### 许可证

版权所有:2016年, [乔恩·斯林克特](https://github.com/jonschlinkert)。 。 。 . 释放 [麻省理工学院许可证](https://github.com/jonschlinkert/to-absolute-glob/blob/master/LICENSE)。 。 。 .

* * *

_此文件由 [动词基因读取器](https://github.com/verbose/verb-generate-readme), v0.2.0, 于2016年10月17日查阅._

## 常见问题

### @dsherret/to-absolute-glob 是什么？

使平面图案绝对化,确保有后缀的负平面图案和图案得到正确处理\.

### 如何安装 @dsherret/to-absolute-glob？

在项目目录运行 npm install @dsherret/to-absolute-glob，或使用 pnpm add / yarn add / bun add。

### @dsherret/to-absolute-glob 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/dsherret\_\_to-absolute-glob 是否存在。

### @dsherret/to-absolute-glob 支持 ESM 还是 CommonJS？

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

### @dsherret/to-absolute-glob 需要什么版本的 Node\.js？

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

### @dsherret/to-absolute-glob 可以商用吗？

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

### @dsherret/to-absolute-glob 的下载量有多少？

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

### @dsherret/to-absolute-glob 还在维护吗？

最新版本 2\.0\.2 发布于 2018/03/08（8 年前）；至今共发布 1 个版本，其中过去 12 个月发布了 0 个；首次发布于 2018/03/08。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

