{"id":15664335,"url":"https://github.com/jonschlinkert/contains-path","last_synced_at":"2025-04-14T16:17:51.783Z","repository":{"id":34705237,"uuid":"38681325","full_name":"jonschlinkert/contains-path","owner":"jonschlinkert","description":"Return true if a file path contains the given path.","archived":false,"fork":false,"pushed_at":"2021-05-18T12:34:51.000Z","size":14,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-09T08:59:02.340Z","etag":null,"topics":["contains","file-path","filepath","includes","match","matches","path"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.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}},"created_at":"2015-07-07T10:42:15.000Z","updated_at":"2024-01-30T04:11:06.000Z","dependencies_parsed_at":"2022-08-28T11:11:30.363Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/contains-path","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcontains-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcontains-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcontains-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcontains-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/contains-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248914117,"owners_count":21182359,"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":["contains","file-path","filepath","includes","match","matches","path"],"created_at":"2024-10-03T13:42:09.557Z","updated_at":"2025-04-14T16:17:51.738Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contains-path [![NPM version](https://img.shields.io/npm/v/contains-path.svg?style=flat)](https://www.npmjs.com/package/contains-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/contains-path.svg?style=flat)](https://npmjs.org/package/contains-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/contains-path.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/contains-path) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/contains-path.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/contains-path)\n\n\u003e Return true if a file path contains the given path.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save contains-path\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add contains-path\n```\n\n## HEADS UP!\n\nAs of v1.0.0, this library no longer uses regex for matching. Please do not hesitate to [report any issues or regressiosn](../../issues/new).\n\n## Usage\n\n```js\nvar containsPath = require('contains-path');\n\ncontainsPath('foo/bar', 'foo'); //=\u003e true\ncontainsPath('foo/bar', 'bar'); //=\u003e true\ncontainsPath('foo/bar', 'qux'); //=\u003e false\n\n// returns false for partial matches\ncontainsPath('foobar', 'foo');  //=\u003e false\ncontainsPath('foo.bar', 'foo'); //=\u003e false\ncontainsPath('foo.bar', 'bar'); //=\u003e false\n\n// prefix with \"./\" to match from beginning of filepath\ncontainsPath('bar/foo', 'foo');   //=\u003e true\ncontainsPath('bar/foo', './foo'); //=\u003e false\n```\n\n## Negation\n\nPrefix with `!` to invert matching behavior:\n\n```js\ncontainsPath('foo/bar', '!foo'); //=\u003e false\ncontainsPath('foo/bar', '!qux'); //=\u003e true\n```\n\n## Options\n\n### options.nocase\n\n**Type**: `boolean`\n\n**Default**: `false`\n\nDisable case sensitivity.\n\n```js\ncontainsPath('foo/bar', 'FOO');                 //=\u003e false\ncontainsPath('foo/bar', 'FOO', {nocase: true}); //=\u003e true\n```\n\n### options.partialMatch\n\n**Type**: `boolean`\n\n**Default**: `false`\n\nAllow \"partial\" matches:\n\n```js\ncontainsPath('foobar', 'foo');                        //=\u003e false                 \ncontainsPath('foobar', 'foo', {partialMatch: true});  //=\u003e true \n\ncontainsPath('foo.bar', 'foo');                       //=\u003e false                 \ncontainsPath('foo.bar', 'foo', {partialMatch: true}); //=\u003e true \n```\n\n## About\n\n### Related projects\n\n* [ends-with](https://www.npmjs.com/package/ends-with): Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for… [more](https://github.com/jonschlinkert/ends-with) | [homepage](https://github.com/jonschlinkert/ends-with \"Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for comparisons.\")\n* [normalize-path](https://www.npmjs.com/package/normalize-path): Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a… [more](https://github.com/jonschlinkert/normalize-path) | [homepage](https://github.com/jonschlinkert/normalize-path \"Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes unless disabled.\")\n* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with \"Return `true` if a file path ends with the given string/suffix.\")\n* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify \"Convert Windows file paths to unix paths.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 2 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 1 | [germtb](https://github.com/germtb) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 17, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fcontains-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fcontains-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fcontains-path/lists"}