{"name":"matcher","version":"6.0.0","description":"Simple wildcard matching","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/matcher.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava","bench":"matcha bench.js"},"keywords":["matcher","matching","match","regex","regexp","regular","expression","wildcard","pattern","string","filter","glob","globber","globbing","minimatch"],"dependencies":{"escape-string-regexp":"^5.0.0"},"devDependencies":{"ava":"^6.4.1","matcha":"^0.7.0","xo":"^1.2.2"},"_id":"matcher@6.0.0","gitHead":"03e11aa72334be59532f5252700a9d14208f3ee4","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/matcher/issues"},"homepage":"https://github.com/sindresorhus/matcher#readme","_nodeVersion":"18.20.4","_npmVersion":"10.9.2","dist":{"integrity":"sha512-TzDerdcNtI79w7Av4GT57bLdElPA/VAkjqdMZv8yhuc8geU2z0ljW9anXbX/55aHEMTpYypZb1lxsA/46r9oOQ==","shasum":"adb96076a0d045cdd601898395b52891755c0cf8","tarball":"http://registry-npm.ywwl.com/matcher/download/matcher-6.0.0.tgz","fileCount":5,"unpackedSize":13612,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDYN0uCgFBoZWrKpyMjeJgCyenliP7R1+6CMqtPSuGJtAiEA8EA8N47ydac3FIemq2F+Uk1CpqUx9tQSfZBa6yWkhbY="}],"size":4231,"noattachment":false,"key":"/matcher/-/matcher-6.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/matcher_6.0.0_1757965511941_0.2798809645501834"},"_hasShrinkwrap":false,"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 at least one of the `patterns`.\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.\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\nRequire all negated patterns to not match and any normal patterns to match at least once. Otherwise, it will be a no-match condition.\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//=> ['foo', 'for', 'bar']\n\nmatcher(['foo', 'for', 'bar'], ['f*'], {allPatterns: true});\n//=> []\n```\n\n#### patterns\n\nType: `string | string[]`\n\nUse `*` to match zero or more characters.\n\nA leading `!` negates the pattern.\n\nAn input string will be omitted, if it does not match any non-negated patterns present, or if it matches a negated pattern, or if no pattern is present.\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":1757965512142,"_cnpm_publish_time":1757965512142,"dist-tags":{"latest":"7.0.0"}}