Registry / serialization / zeptomatch-unescape

zeptomatch-unescape

JSON →
library1.0.1jsnpmunverified

zeptomatch-unescape is a small, specialized JavaScript utility designed to remove backslash escape sequences from glob patterns. It specifically targets characters commonly treated as special in glob syntax (e.g., `*`, `?`, `[`, `]`), converting `\*` to `*`, `\?` to `?`, and so on. This normalization is crucial when you need to interpret a glob pattern literally, especially if the pattern was generated dynamically or requires further processing without accidental escape interpretation. Currently at stable version 1.0.1, the package is maintained with a focus on reliability and correctness for its specific function, implying an infrequent release cadence. It integrates seamlessly into broader pattern matching pipelines, notably mentioned as a companion to `zeptomatch-is-static` for optimizing glob evaluation by first identifying and then handling truly static parts. This clear, single-purpose design differentiates it by offering a reliable component for complex pattern manipulation workflows.

npm install zeptomatch-unescape
INSTALL
IMPORT
SIG · ZEPTOMATCH-UNESCAP
Z
zeptomatch-unescape
serializationjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

unescape
import unescape from 'zeptomatch-unescape';
import { unescape } from 'zeptomatch-unescape';
The primary function is exported as the default export, hence no curly braces are needed for import.
unescape (CJS)
const unescape = require('zeptomatch-unescape');
const { unescape } = require('zeptomatch-unescape');
For CommonJS environments, the default export is directly assigned when requiring the module.
Types
import type { Unescape } from 'zeptomatch-unescape';
While 'unescape' is a simple function, its type can be imported for explicit type annotations if needed, though `typeof unescape` often suffices.

This quickstart demonstrates how to import and use the `unescape` function to remove backslash escape sequences from various glob patterns, illustrating its specific behavior.

import unescape from 'zeptomatch-unescape'; // Example 1: Basic unescaping of glob special characters const glob1 = 'foo\\*bar\\?'; const unescapedGlob1 = unescape(glob1); console.log(`Original: "${glob1}" -> Unescaped: "${unescapedGlob1}"`); // Expected: Original: "foo\*bar\?" -> Unescaped: "foo*bar?" // Example 2: Glob with no special characters or escapes const glob2 = 'path/to/file.txt'; const unescapedGlob2 = unescape(glob2); console.log(`Original: "${glob2}" -> Unescaped: "${unescapedGlob2}"`); // Expected: Original: "path/to/file.txt" -> Unescaped: "path/to/file.txt" // Example 3: Mixed escapes and non-escaped characters const glob3 = 'dir/\\*.js'; const unescapedGlob3 = unescape(glob3); console.log(`Original: "${glob3}" -> Unescaped: "${unescapedGlob3}"`); // Expected: Original: "dir/\*.js" -> Unescaped: "dir/*.js" // Example 4: Escapes that are not glob special characters (should remain) const glob4 = 'file\\-name.txt'; const unescapedGlob4 = unescape(glob4); console.log(`Original: "${glob4}" -> Unescaped: "${unescapedGlob4}"`); // Expected: Original: "file\-name.txt" -> Unescaped: "file\-name.txt"
Debug
Known issues
gotchaThe utility specifically unescapes glob special characters (e.g., `*`, `?`, `[`, `]`). Other backslash escapes (e.g., `\n`, `\t`, or non-glob character escapes like `\-`) are preserved, as it's not a general-purpose string unescaper.
fix
Understand that `zeptomatch-unescape` operates strictly on glob syntax escapes. For general string unescaping, use a different utility or standard JavaScript string methods.
affects: >=1.0.0
gotchaThis package performs only unescaping and does not validate the glob pattern's syntax or ensure it forms a valid glob after unescaping.
fix
Combine with a glob parsing or validation library if robust glob pattern validation or deeper analysis is required after unescaping.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: zeptomatch_unescape_1.default is not a function
Incorrect CommonJS `require` syntax when trying to import a default export from an ES module.
fix
Change the import statement to `const unescape = require('zeptomatch-unescape');` in CommonJS files, or ensure your build configuration correctly handles ES module interop.
Cannot find module 'zeptomatch-unescape'
The package is not installed or the import path is incorrect.
fix
Run `npm install zeptomatch-unescape` to install the package and double-check that the import path in your code exactly matches `zeptomatch-unescape`.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
zeptomatch-unescape — npm install zeptomatch-unescape · libregistry