Registry / serialization / zeptomatch-is-static

zeptomatch-is-static

JSON →
library1.0.1jsnpmunverified

zeptomatch-is-static is a lightweight utility designed to ascertain if a given glob pattern is entirely static, meaning it contains no dynamic wildcards or special glob syntax. It is part of the 'zeptomatch' ecosystem of packages, known for being absurdly small, opinionated, and highly performant for glob matching. The current stable version is 1.0.1, last published approximately a year ago, indicating a stable release cycle for focused utilities. Unlike broader glob libraries that offer extensive configuration, `zeptomatch-is-static` provides a singular, optimized function to quickly check for static patterns. A key differentiator is its specific interpretation where escaped characters are considered static, necessitating separate unescaping if a truly dynamic check is required. The library ships with TypeScript types, ensuring good developer experience in TypeScript projects.

npm install zeptomatch-is-static
INSTALL
IMPORT
SIG · ZEPTOMATCH-IS-STAT
Z
zeptomatch-is-static
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.

isStatic
import isStatic from 'zeptomatch-is-static';
const isStatic = require('zeptomatch-is-static');
The package primarily targets ESM environments. While a CommonJS `require` might work in some setups, projects using `"type": "module"` or newer Node.js versions may encounter `ERR_REQUIRE_ESM` when attempting CommonJS imports, as seen with other `zeptomatch` ecosystem packages.

Demonstrates how to import and use `isStatic` to check various glob patterns, distinguishing between static and dynamic strings, including those with escaped characters.

import isStatic from 'zeptomatch-is-static'; // Install the package // npm install zeptomatch-is-static console.log(isStatic('foo')); // true console.log(isStatic('foo/bar')); // true console.log(isStatic('foo\\*bar')); // true (escaped characters are considered static) console.log(isStatic('*')); // false console.log(isStatic('**')); // false console.log(isStatic('foo*')); // false console.log(isStatic('foo/**/*')); // false console.log(isStatic('foo*bar')); // false
Debug
Known issues
gotchaThe `isStatic` function considers escaped glob characters (e.g., `foo\*bar`) as part of a static pattern. If you need to treat these as dynamic or remove the escapes for further processing, you should use `zeptomatch-unescape` in conjunction with this package.
fix
Use `zeptomatch-unescape` to preprocess globs if escaped characters should be treated as dynamic wildcards or literal characters after unescaping. Example: `isStatic(unescape('foo\\*bar'))` would return `isStatic('foo*bar')` which is `false`.
affects: >=1.0.0
gotchaThis package, like other `zeptomatch` utilities, is designed for ESM (ECMAScript Module) imports. Attempting to use `require()` in an environment configured for ESM (e.g., a Node.js project with `"type": "module"` in `package.json`) can lead to import errors.
fix
Always use `import isStatic from 'zeptomatch-is-static';` for consistent behavior. If you are in a CommonJS environment, ensure your bundler or Node.js version supports interoperability, or consider dynamically importing if strictly necessary for mixed modules.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: isStatic is not a function
Attempting to call `isStatic` after an incorrect CommonJS `require` import in an ESM context, or a typo in the import.
fix
Ensure you are using the correct ESM import syntax: `import isStatic from 'zeptomatch-is-static';`. If in a CommonJS-only file, verify the package's `package.json` for `main` or `exports` fields, or consider dynamic `import()`.
Unexpected 'true' for a glob with escaped wildcard characters.
Misunderstanding how `zeptomatch-is-static` defines 'static' patterns. It considers `foo\*bar` as static because the wildcard character `*` is escaped, making it a literal character.
fix
If the intent is to check if a glob contains *any* dynamic elements, including escaped wildcards, first unescape the glob using `zeptomatch-unescape` before passing it to `isStatic`. For example: `import unescape from 'zeptomatch-unescape'; isStatic(unescape('foo\\*bar')); // => false`.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
36
OpenAI (training)
1
Resources
zeptomatch-is-static — npm install zeptomatch-is-static · libregistry