{"id":12704,"library":"zeptomatch-is-static","title":"Zeptomatch Is Static","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fabiospampinato/zeptomatch-is-static","tags":["javascript","zeptomatch","is","static","typescript"],"install":[{"cmd":"npm install zeptomatch-is-static","lang":"bash","label":"npm"},{"cmd":"yarn add zeptomatch-is-static","lang":"bash","label":"yarn"},{"cmd":"pnpm add zeptomatch-is-static","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"const isStatic = require('zeptomatch-is-static');","symbol":"isStatic","correct":"import isStatic from 'zeptomatch-is-static';"}],"quickstart":{"code":"import isStatic from 'zeptomatch-is-static';\n\n// Install the package\n// npm install zeptomatch-is-static\n\nconsole.log(isStatic('foo')); // true\nconsole.log(isStatic('foo/bar')); // true\nconsole.log(isStatic('foo\\\\*bar')); // true (escaped characters are considered static)\n\nconsole.log(isStatic('*')); // false\nconsole.log(isStatic('**')); // false\nconsole.log(isStatic('foo*')); // false\nconsole.log(isStatic('foo/**/*')); // false\nconsole.log(isStatic('foo*bar')); // false","lang":"typescript","description":"Demonstrates how to import and use `isStatic` to check various glob patterns, distinguishing between static and dynamic strings, including those with escaped characters."},"warnings":[{"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`.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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()`.","cause":"Attempting to call `isStatic` after an incorrect CommonJS `require` import in an ESM context, or a typo in the import.","error":"TypeError: isStatic is not a function"},{"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`.","cause":"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.","error":"Unexpected 'true' for a glob with escaped wildcard characters."}],"ecosystem":"npm"}