Registry / devops / glob-path

glob-path

JSON →
library0.4.0jsnpmunverified

A lightweight library for matching and replacing strings using glob patterns. Version 0.4.0 provides a rule-based engine with custom asterisk semantics (****, ***, **, *) and expression-based replacements. It supports path parsing, extensible rules, and callbacks. The package is minimal compared to alternatives like glob or fast-glob, offering a unique replacement syntax using {expressions} and glob array indexing. Suitable for build pipelines or custom path transformations. Release cadence is low; appears to be a niche tool maintained on GitHub.

npm install glob-path
INSTALL
IMPORT
SIG · GLOB-PATH
G
glob-path
devopsjavascriptv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (Glob class)
import { Glob } from 'glob-path'
const { Glob } = require('glob-path')
ESM-only; the package does not export a default, use named import
Glob
const { Glob } = await import('glob-path')
const glob = require('glob-path')
Dynamic import with named import; package is ESM-only
types
import type { Glob as GlobType } from 'glob-path'
TypeScript types are not exported; use the class directly

Shows basic rule matching: match any path ending in .txt and redirect to backup/ folder preserving path and basename.

import { Glob } from 'glob-path'; const glob = new Glob(); glob.addRule('**/*.txt', 'backup/{...}/{basename}'); const result = glob.dest('/docs/readme.txt'); // result: 'backup/docs/readme.txt' console.log(result);
Debug
Known issues
gotchaAsterisk semantics differ from standard glob: **** matches everything, *** matches paths+barename+ext, ** matches paths only, * matches pathname or basename or extname, not segments.
fix
Refer to documentation for correct pattern usage; test patterns against expected behavior.
affects: >=0.0.0
gotchaaddRule with a function callback requires explicit return for matched rules; if a rule returns undefined, processing continues to next rule.
fix
Always return a string from callback to stop rule processing, or omit return to let next rule handle.
affects: >=0.0.0
breakingv0.4.0 API uses a constructor (new Glob()) and calls addRule/dest; earlier versions may have different API.
fix
Update to v0.4.0 and adjust code to use class-based API.
affects: <0.4.0
deprecatedThe package's GitHub repository is archived or has no recent updates; may indicate abandonment.
fix
Consider using more maintained alternatives like glob or fast-glob.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'dest')
Importing the package incorrectly, likely importing a non-existent default export.
fix
Use named import: import { Glob } from 'glob-path' then const glob = new Glob()
Error: Rule not matched
The pattern does not match the input path due to custom asterisk semantics.
fix
Ensure pattern uses ****, ***, **, or * correctly; test with glob.parse or simpler patterns.
TypeError: glob.addRule is not a function
Missing 'new' keyword when instantiating Glob, or importing as default.
fix
Use: const glob = new Glob(); then glob.addRule(...)
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
glob-path — npm install glob-path · libregistry