{"name":"matcher","version":"6.1.0","keywords":["matcher","matching","match","regex","regexp","regular","expression","wildcard","pattern","string","filter","glob","globber","globbing","minimatch"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"matcher@6.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/matcher#readme","bugs":{"url":"https://github.com/sindresorhus/matcher/issues"},"dist":{"shasum":"4be63bd8ed3e7aaf6cc9589866d529bd766cfe15","tarball":"http://registry-npm.ywwl.com/matcher/download/matcher-6.1.0.tgz","fileCount":5,"integrity":"sha512-sIUMoFfOqpltCE/cimkSZ0wuBAh17C8+P6BMaBXe5biLopo4oUBDYYqJ9NPMrnmg2z9zdujscgBfA4wohhVqOQ==","signatures":[{"sig":"MEYCIQCibTaeojyi23V0pRNqdyjkrrhLYRABL4duIHmoA3LkEQIhANITqn5hm/ZE/eh/fo7+oGtpPzkJa+gE0/ZP0TPuCQeb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDBEJos9LEguCcDl7VoqYT4e7+/yhTHJwO9rCPIM3oDugIhAKhiva9QoPk76T7BOYORDzVqnhPDV9OTdBPsHROVBGp3","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16000,"size":5099,"noattachment":false,"key":"/matcher/-/matcher-6.1.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"eb170157fe6c03e26edbcc60b6cd9fad6bce992d","scripts":{"test":"xo && ava","bench":"matcha bench.js"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/matcher.git","type":"git"},"_npmVersion":"12.0.1","description":"Simple wildcard matching","directories":{},"sideEffects":false,"_nodeVersion":"26.9.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1","matcha":"^0.7.0"},"_npmOperationalInternal":{"tmp":"tmp/matcher_6.1.0_1790363480317_0.624161502495642","host":"s3://npm-registry-packages-npm-production"},"readme":"# matcher\n\n> Simple [wildcard](https://en.wikipedia.org/wiki/Wildcard_character) matching\n\nUseful when you want to accept loose string input and regexes/globs are too convoluted.\n\n## Install\n\n```sh\nnpm install matcher\n```\n\n## Usage\n\n```js\nimport {matcher, isMatch} from 'matcher';\n\nmatcher(['foo', 'bar', 'moo'], ['*oo', '!foo']);\n//=> ['moo']\n\nmatcher(['foo', 'bar', 'moo'], ['!*oo']);\n//=> ['bar']\n\nmatcher('moo', ['']);\n//=> []\n\nmatcher('moo', []);\n//=> []\n\nmatcher([''], ['']);\n//=> ['']\n\nisMatch('unicorn', 'uni*');\n//=> true\n\nisMatch('unicorn', '*corn');\n//=> true\n\nisMatch('unicorn', 'un*rn');\n//=> true\n\nisMatch('rainbow', '!unicorn');\n//=> true\n\nisMatch('foo bar baz', 'foo b* b*');\n//=> true\n\nisMatch('unicorn', 'uni\\\\*');\n//=> false\n\nisMatch(['foo', 'bar'], 'f*');\n//=> true\n\nisMatch(['foo', 'bar'], ['a*', 'b*']);\n//=> true\n\nisMatch('unicorn', ['']);\n//=> false\n\nisMatch('unicorn', []);\n//=> false\n\nisMatch([], 'bar');\n//=> false\n\nisMatch([], []);\n//=> false\n\nisMatch([''], ['']);\n//=> true\n\n// With `allPatterns` option\nisMatch('foobar', ['foo*', '*bar'], {allPatterns: true});\n//=> true\n\nisMatch('foo', ['foo*', '*bar'], {allPatterns: true});\n//=> false\n```\n\n## API\n\nIt matches even across newlines. For example, `foo*r` will match `foo\\nbar`.\n\n### matcher(inputs, patterns, options?)\n\nAccepts a string or an array of strings for both `inputs` and `patterns`.\n\nReturns an array of `inputs` filtered based on the `patterns`.\n\n### isMatch(inputs, patterns, options?)\n\nAccepts a string or an array of strings for both `inputs` and `patterns`.\n\nReturns a `boolean` of whether any of the given `inputs` matches the `patterns`. With `allPatterns` enabled, an input has to match every non-negated pattern, not just one.\n\n#### inputs\n\nType: `string | string[]`\n\nThe string or array of strings to match.\n\n#### options\n\nType: `object`\n\n##### caseSensitive\n\nType: `boolean`\\\nDefault: `false`\n\nMake matching case-sensitive. When `false`, treats uppercase and lowercase characters as being the same, the way a case-insensitive regular expression without the `u` flag does. So a character whose uppercase form is more than one character (`ß`) or is ASCII while the character itself is not (`ı`, `ſ`), and every character outside the Basic Multilingual Plane, only matches itself.\n\nEnsure you use this correctly. For example, files and directories should be matched case-insensitively, while most often, object keys should be matched case-sensitively.\n\n```js\nimport {isMatch} from 'matcher';\n\nisMatch('UNICORN', 'UNI*', {caseSensitive: true});\n//=> true\n\nisMatch('UNICORN', 'unicorn', {caseSensitive: true});\n//=> false\n\nisMatch('unicorn', ['tri*', 'UNI*'], {caseSensitive: true});\n//=> false\n```\n\n##### allPatterns\n\nType: `boolean`\\\nDefault: `false`\n\nA negated pattern always excludes the inputs it matches, whether or not this option is set. Setting it also requires every non-negated pattern to match the same input, instead of at least one of them.\n\n```js\nimport {matcher} from 'matcher';\n\n// Find text strings containing both \"edge\" and \"tiger\" in arbitrary order, but not \"stunt\".\nconst demo = (strings) => matcher(strings, ['*edge*', '*tiger*', '!*stunt*'], {allPatterns: true});\n\ndemo(['Hey, tiger!', 'tiger has edge over hyenas', 'pushing a tiger over the edge is a stunt']);\n//=> ['tiger has edge over hyenas']\n```\n\n```js\nimport {matcher} from 'matcher';\n\nmatcher(['foo', 'for', 'bar'], ['f*', 'b*', '!x*'], {allPatterns: true});\n//=> []\n\nmatcher(['foo', 'for', 'bar'], ['f*'], {allPatterns: true});\n//=> ['foo', 'for']\n```\n\n#### patterns\n\nType: `string | string[]`\n\nUse `*` to match zero or more characters.\n\nA leading `!` negates the pattern.\n\nA `\\` escapes the character after it, so `\\*` matches a literal `*` and `\\\\` matches a literal `\\`. A `\\` at the very end of a pattern matches itself.\n\nAn input string will be omitted if there is no pattern at all, if it matches a negated pattern, or if there are non-negated patterns and it fails to match them: all of them when `allPatterns` is set, at least one otherwise. When every pattern is negated, an input is kept as long as it matches none of them.\n\n```js\nimport {isMatch} from 'matcher';\n\nisMatch('unicorn', 'uni\\\\*');\n//=> false\n\nisMatch('uni*', 'uni\\\\*');\n//=> true\n\n// Every backslash in a Windows path has to be doubled, otherwise the first one escapes the second.\nisMatch('C:\\\\temp\\\\x', 'C:\\\\\\\\temp\\\\\\\\*');\n//=> true\n\nisMatch('C:\\\\temp\\\\x', 'C:\\\\temp\\\\*');\n//=> false\n```\n\n## Benchmark\n\n```sh\nnpm run bench\n```\n\n## Related\n\n- [matcher-cli](https://github.com/sindresorhus/matcher-cli) - CLI for this module\n- [multimatch](https://github.com/sindresorhus/multimatch) - Extends `minimatch.match()` with support for multiple patterns\n","publish_time":1790363480406,"_cnpm_publish_time":1790363480406,"dist-tags":{"latest":"7.0.0"}}