@dsherret/to-absolute-glob

中文文档
2.0.2发布于 2018/03/08MITCommonJS近 30 天下载 37.5万

Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.

原始使用文档
文档目录11 节
  1. Install
  2. Usage
  3. Examples
  4. About
  5. Related projects
  6. Contributing
  7. Contributors
  8. Building docs
  9. Running tests
  10. Author
  11. License

to-absolute-glob NPM version NPM downloads Linux Build Status Windows Build Status

Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.

Install

Install with npm:

$ npm install --save to-absolute-glob

Usage

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

Examples

Given the current project folder (cwd) is /dev/foo/:

makes a path absolute

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

makes a glob absolute

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

retains trailing slashes

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

retains trailing slashes with cwd

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

makes a negative glob absolute

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

from a cwd

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

makes a negative glob absolute from a cwd

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

from a root path

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

from a root slash

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

from a negative root path

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

from a negative root slash

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

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

| Commits | Contributor
| | --- | --- | | 16 | doowb | | 15 | jonschlinkert | | 1 | phated | | 1 | erikkemperman |

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

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

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.2.0, on October 17, 2016.

版本与发布记录

@dsherret/to-absolute-glob 共发布 1 个版本,首次发布于 2018/03/08;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.2latest2018/03/088 年前

关于 @dsherret/to-absolute-glob 的常见问题

@dsherret/to-absolute-glob 是什么?

Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.

如何安装 @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 和提交记录判断。