{"name":"zeptomatch","version":"2.0.2","keywords":["tiny","glob","match","matcher"],"license":"MIT","_id":"zeptomatch@2.0.2","maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"homepage":"https://github.com/fabiospampinato/zeptomatch#readme","bugs":{"url":"https://github.com/fabiospampinato/zeptomatch/issues"},"dist":{"shasum":"8ef6a2288a8cde753a02327305ac912914416ab4","tarball":"http://registry-npm.ywwl.com/zeptomatch/download/zeptomatch-2.0.2.tgz","fileCount":17,"integrity":"sha512-H33jtSKf8Ijtb5BW6wua3G5DhnFjbFML36eFu+VdOoVY4HD9e7ggjqdM6639B+L87rjnR6Y+XeRzBXZdy52B/g==","signatures":[{"sig":"MEUCICyyOsCjbcJWdvpeaVD7G6JnryWl068wMGJMw+ulmIrJAiEAuX261XQ7EdPeog5xPFgyOfiBv0/UhdKzrO9NMLPU0lQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14647,"size":5077,"noattachment":false,"key":"/zeptomatch/-/zeptomatch-2.0.2.tgz"},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","gitHead":"5757ed786fd2e7f9504bb461d0155bca32f42cf6","scripts":{"test":"tsex test","clean":"tsex clean","compile":"tsex compile","test:watch":"tsex test --watch","compile:watch":"tsex compile --watch","prepublishOnly":"tsex prepare"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"repository":{"url":"git+https://github.com/fabiospampinato/zeptomatch.git","type":"git"},"_npmVersion":"10.2.3","description":"An absurdly small glob matcher that packs a punch.","directories":{},"_nodeVersion":"18.19.0","dependencies":{"grammex":"^3.1.10"},"_hasShrinkwrap":false,"devDependencies":{"fava":"^0.3.4","tsex":"^4.0.2","typescript":"^5.8.2"},"_npmOperationalInternal":{"tmp":"tmp/zeptomatch_2.0.2_1749931363919_0.876254858811863","host":"s3://npm-registry-packages-npm-production"},"readme":"# Zeptomatch\n\nAn absurdly small glob matcher that packs a punch.\n\n## Overview\n\nThe following syntax is supported:\n\n| Syntax      | Description                                                                                                                             |\n| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| `*`         | Matches any character, except for the path separator, zero or more times.                                                               |\n| `**`        | Matches any character zero or more times. If it doesn't span the entire length of a path segment it's interpreted as a `*` instead.     |\n| `?`         | Matches any character, except for the path separator, one time.                                                                         |\n| `\\`         | Matches the character after it in the glob literally. This is the escape operator.                                                      |\n| `[abc]`     | Matches any of the characters in the class one time.                                                                                    |\n| `[a-z]`     | Matches any of the characters in the range in the class one time.                                                                       |\n| `[^abc]`    | Matches any character, except for the characters in the class, and the path separator, one time. Aliased as `[!abc]` also.              |\n| `[^a-z]`    | Matches any character, except for the characters in the range in the class, and the path separator, one time. Aliased as `[!a-z]` also. |\n| `{foo,bar}` | Matches any of the alternations, which are separated by a comma, inside the braces.                                                     |\n| `{01..99}`  | Matches any of the numbers in the expanded range. Padding is supported and opt-in.                                                      |\n| `{a..zz}`   | Matches any of the strings in the expanded range. Upper-cased ranges are supported and opt-in.                                          |\n| `!glob`     | Matches anything except the provided glob. Negations can only be used at the start of the glob.                                         |\n| `!!glob`    | Matches the provided glob. Negations can only be used at the start of the glob.                                                         |\n\nAdditional features and details:\n\n- Zeptomatch works pretty similarly to [`picomatch`](https://github.com/micromatch/picomatch), since 1000+ of its tests are being used by this library.\n- Zeptomatch is opinionated, there are barely any options, which helps with keeping it tiny and manageable.\n- Zeptomatch is automatically memoized, the only ways to use it are always the most optimized ones available.\n- Zeptomatch automatically normalizes path separators, since matching Windows-style paths would most likely be a mistake.\n- Zeptomatch supports compiling a glob to a standalone regular expression.\n- Zeptomatch supports compiling multiple globs to a standalone regular expression too.\n- Zeptomatch doesn't do anything special for file names starting with a dot.\n- Zeptomatch supports nesting braces indefinitely.\n- Zeptomatch supports matching globs partially too, with path segment-level awareness!\n\nLimitations:\n\n- POSIX classes (e.g. `[:alnum:]`) are not supported. Implementing them is out of scope for a \"zepto\"-level library.\n- Extglobs (e.g. `?(foo)`) are not supported. They are too complicated and quirky too support here.\n\n## Install\n\n```sh\nnpm install zeptomatch\n```\n\n## Usage\n\n```ts\nimport zeptomatch from 'zeptomatch';\n\n// Let's check if a glob matches a path, fully\n\nzeptomatch ( '*.js', 'abcd' ); // => false\nzeptomatch ( '*.js', 'a.js' ); // => true\nzeptomatch ( '*.js', 'a.md' ); // => false\nzeptomatch ( '*.js', 'a/b.js' ); // => false\n\n// Let's check if a glob matches a path, partially\n// Matching partially is very useful for performance when traversing the filesystem\n// It's important to not match the glob partially anymore once you have the full path available though!\n\nzeptomatch ( 'foo/bar/*.js', 'foo', { partial: true } ); // => true\nzeptomatch ( 'foo/bar/*.js', 'foo/bar', { partial: true } ); // => true\nzeptomatch ( 'foo/bar/*.js', 'foo/bar/_', { partial: true } ); // => false, as no additional path segment could ever make this match\nzeptomatch ( 'foo/bar/*.js', 'foo/bar/file.js' ); // => true, remember to not match the full path partially\n\n// Let's compile a glob to a regular expression that matches fully\n\nconst fullRe = zeptomatch.compile ( 'src/*.js' ); // => /^(?:src[\\\\/][^\\\\/]*\\.js)[\\\\/]?$/s\n\n// Let's compile a glob to a regular expression that matches partially\n\nconst partialRe = zeptomatch.compile ( '*.js', { partial: true } ); // => /^(?:src(?:$|[\\\\/](?:$|[^\\\\/]*\\.js)))[\\\\/]?$/s\n```\n\n## Utilities\n\nThe following additional utilities are available, as standalone packages:\n\n- [`zeptomatch-escape`](https://github.com/fabiospampinato/zeptomatch-escape): A little utility for escaping globs before passing them to zeptomatch.\n- [`zeptomatch-explode`](https://github.com/fabiospampinato/zeptomatch-explode): A little utility for exploding a zeptomatch-flavored glob into its dynamic and static parts.\n- [`zeptomatch-is-static`](https://github.com/fabiospampinato/zeptomatch-is-static): A little utility for checking if a glob is fully static.\n- [`zeptomatch-unescape`](https://github.com/fabiospampinato/zeptomatch-unescape): A little utility for removing escape sequences from a glob.\n\n## License\n\nMIT © Fabio Spampinato\n","publish_time":1749931364108,"_cnpm_publish_time":1749931364108,"dist-tags":{"latest":"2.1.0"}}