{"id":13583244,"url":"https://github.com/micromatch/anymatch","last_synced_at":"2025-05-14T20:07:51.752Z","repository":{"id":9551045,"uuid":"11458302","full_name":"micromatch/anymatch","owner":"micromatch","description":":bangbang: Matches strings against configurable strings, globs, regular expressions, and/or functions","archived":false,"fork":false,"pushed_at":"2023-05-18T16:52:59.000Z","size":94,"stargazers_count":391,"open_issues_count":7,"forks_count":41,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-14T18:03:47.311Z","etag":null,"topics":["fs","glob","javascript","match","matcher","micromatch","minimatch","multimatch","node","nodejs","regex","regular-expression"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micromatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["doowb","jonschlinkert"]}},"created_at":"2013-07-16T19:33:13.000Z","updated_at":"2025-04-14T15:47:15.000Z","dependencies_parsed_at":"2024-04-08T18:06:28.135Z","dependency_job_id":null,"html_url":"https://github.com/micromatch/anymatch","commit_stats":{"total_commits":157,"total_committers":15,"mean_commits":"10.466666666666667","dds":0.4394904458598726,"last_synced_commit":"cbd278e43710eaf325d2061fa11aefd127c509be"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromatch%2Fanymatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromatch%2Fanymatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromatch%2Fanymatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micromatch%2Fanymatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micromatch","download_url":"https://codeload.github.com/micromatch/anymatch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933339,"owners_count":21185460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fs","glob","javascript","match","matcher","micromatch","minimatch","multimatch","node","nodejs","regex","regular-expression"],"created_at":"2024-08-01T15:03:21.085Z","updated_at":"2025-04-14T18:05:03.387Z","avatar_url":"https://github.com/micromatch.png","language":"JavaScript","readme":"anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master)\n======\nJavascript module to match a string against a regular expression, glob, string,\nor function that takes the string as an argument and returns a truthy or falsy\nvalue. The matcher can also be an array of any or all of these. Useful for\nallowing a very flexible user-defined config to define things like file paths.\n\n__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__\n\n\nUsage\n-----\n```sh\nnpm install anymatch\n```\n\n#### anymatch(matchers, testString, [returnIndex], [options])\n* __matchers__: (_Array|String|RegExp|Function_)\nString to be directly matched, string with glob patterns, regular expression\ntest, function that takes the testString as an argument and returns a truthy\nvalue if it should be matched, or an array of any number and mix of these types.\n* __testString__: (_String|Array_) The string to test against the matchers. If\npassed as an array, the first element of the array will be used as the\n`testString` for non-function matchers, while the entire array will be applied\nas the arguments for function matchers.\n* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.\n    * __returnIndex__: (_Boolean [optional]_) If true, return the array index of\nthe first matcher that that testString matched, or -1 if no match, instead of a\nboolean result.\n\n```js\nconst anymatch = require('anymatch');\n\nconst matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string =\u003e string.includes('bar') \u0026\u0026 string.length \u003e 10 ] ;\n\nanymatch(matchers, 'path/to/file.js'); // true\nanymatch(matchers, 'path/anyjs/baz.js'); // true\nanymatch(matchers, 'path/to/foo.js'); // true\nanymatch(matchers, 'path/to/bar.js'); // true\nanymatch(matchers, 'bar.js'); // false\n\n// returnIndex = true\nanymatch(matchers, 'foo.js', {returnIndex: true}); // 2\nanymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1\n\n// any picomatc\n\n// using globs to match directories and their children\nanymatch('node_modules', 'node_modules'); // true\nanymatch('node_modules', 'node_modules/somelib/index.js'); // false\nanymatch('node_modules/**', 'node_modules/somelib/index.js'); // true\nanymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false\nanymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true\n\nconst matcher = anymatch(matchers);\n['foo.js', 'bar.js'].filter(matcher);  // [ 'foo.js' ]\nanymatch master* ❯\n\n```\n\n#### anymatch(matchers)\nYou can also pass in only your matcher(s) to get a curried function that has\nalready been bound to the provided matching criteria. This can be used as an\n`Array#filter` callback.\n\n```js\nvar matcher = anymatch(matchers);\n\nmatcher('path/to/file.js'); // true\nmatcher('path/anyjs/baz.js', true); // 1\n\n['foo.js', 'bar.js'].filter(matcher); // ['foo.js']\n```\n\nChangelog\n----------\n[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)\n\n- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.\n- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).\n- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)\nfor glob pattern matching. Issues with glob pattern matching should be\nreported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).\n\nLicense\n-------\n[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE)\n","funding_links":["https://github.com/sponsors/doowb","https://github.com/sponsors/jonschlinkert"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicromatch%2Fanymatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicromatch%2Fanymatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicromatch%2Fanymatch/lists"}