Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@gulpjs/to-absolute-glob
Advanced tools
Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.
@gulpjs/to-absolute-glob is an npm package that converts a given glob pattern to an absolute glob pattern. This is particularly useful in build systems and task runners like Gulp, where you need to work with file paths in a consistent manner.
Convert relative glob to absolute glob
This feature allows you to convert a relative glob pattern to an absolute glob pattern. The `cwd` option specifies the current working directory to resolve the relative path.
const toAbsoluteGlob = require('@gulpjs/to-absolute-glob');
const absoluteGlob = toAbsoluteGlob('./src/**/*.js', { cwd: process.cwd() });
console.log(absoluteGlob);
Handle negated globs
This feature supports negated glob patterns, which are used to exclude files from a set of matched files. The `!` character at the beginning of the glob pattern indicates negation.
const toAbsoluteGlob = require('@gulpjs/to-absolute-glob');
const absoluteGlob = toAbsoluteGlob('!./src/**/*.test.js', { cwd: process.cwd() });
console.log(absoluteGlob);
Options for handling different path formats
This feature allows you to specify additional options like `root` to handle different path formats. This can be useful when working in environments with different directory structures.
const toAbsoluteGlob = require('@gulpjs/to-absolute-glob');
const absoluteGlob = toAbsoluteGlob('./src/**/*.js', { cwd: process.cwd(), root: '/' });
console.log(absoluteGlob);
The `glob` package is a popular library for matching files using glob patterns. It provides extensive functionality for pattern matching and file searching, but it does not specifically focus on converting relative globs to absolute globs like @gulpjs/to-absolute-glob.
The `fast-glob` package is a high-performance glob library that supports advanced features like concurrency and caching. While it excels in performance and flexibility, it does not provide a direct method for converting relative globs to absolute globs.
The `minimatch` package is a minimalistic library for matching file paths against glob patterns. It is often used as a dependency in other glob-related packages. However, it does not offer functionality for converting relative globs to absolute globs.
Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.
var toAbsoluteGlob = require('@gulpjs/to-absolute-glob');
// All these assume your cwd is `/dev/foo/`
toAbsoluteGlob('a/*.js') === '/dev/foo/a/*.js';
// Makes a path absolute
toAbsoluteGlob('a') === '/dev/foo/a';
// Retains trailing slashes
toAbsoluteGlob('a/*/') === '/dev/foo/a/*/';
// Makes a negative glob absolute
toAbsoluteGlob('!a/*.js') === '!/dev/foo/a/*.js';
// Accepts a cwd
toAbsoluteGlob('a/*.js', { cwd: 'foo' }) === '/dev/foo/foo/a/*.js';
// Accepts a root path
toAbsoluteGlob('/a/*.js', { root: 'baz' }) === '/dev/foo/baz/a/*.js';
toAbsoluteGlob(glob, [options])
Takes a glob
string and an optional options
object and produces an absolute glob. If the glob is relative, the root
or cwd
option (or process.cwd()
if neither specified) will be used as the base of the glob.
MIT
4.0.0 (2023-01-03)
FAQs
Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.
The npm package @gulpjs/to-absolute-glob receives a total of 525,360 weekly downloads. As such, @gulpjs/to-absolute-glob popularity was classified as popular.
We found that @gulpjs/to-absolute-glob demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.