{"_id":"path-starts-with","_rev":"97726","name":"path-starts-with","description":"Returns true if a filepath starts with the given string. Works with windows and posix/unix paths.","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:32:51.000Z","created":"2017-04-17T06:42:00.036Z","2.0.0":"2019-04-29T08:41:43.252Z","1.0.0":"2017-04-17T06:42:00.036Z"},"users":{"rbecheras":true},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/path-starts-with.git"},"versions":{"2.0.0":{"name":"path-starts-with","description":"Returns true if a filepath starts with the given string. Works with windows and posix/unix paths.","version":"2.0.0","homepage":"https://github.com/jonschlinkert/path-starts-with","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/path-starts-with.git"},"bugs":{"url":"https://github.com/jonschlinkert/path-starts-with/issues"},"license":"MIT","main":"index.js","engines":{"node":">=8"},"scripts":{"test":"mocha"},"devDependencies":{"gulp-format-md":"^2.0.0","mocha":"^6.1.4"},"keywords":["directory","file path","file","filepath","folder","fs","inside","path","posix","relative","slash","slashes","starts","startsWith","util","utility","utils","windows"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["path-ends-with","contains-path","normalize-path"]},"lint":{"reflinks":true}},"gitHead":"a964356d374df4e27ee820299b0698c2a36284fe","_id":"path-starts-with@2.0.0","_nodeVersion":"12.0.0","_npmVersion":"6.9.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"shasum":"ffd6d51926cd497022b44d392196033d5451892f","size":3756,"noattachment":false,"key":"/path-starts-with/-/path-starts-with-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-starts-with/download/path-starts-with-2.0.0.tgz"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/path-starts-with_2.0.0_1556527303107_0.3569409173525979"},"_hasShrinkwrap":false,"publish_time":1556527303252,"_cnpm_publish_time":1556527303252},"1.0.0":{"name":"path-starts-with","description":"Returns true if a filepath starts with the given string. Works with windows and posix/unix paths.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/path-starts-with","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/path-starts-with.git"},"bugs":{"url":"https://github.com/jonschlinkert/path-starts-with/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"mocha"},"dependencies":{"normalize-path":"^2.1.1"},"devDependencies":{"gulp-format-md":"^0.1.12","mocha":"^3.2.0"},"keywords":["generategenerator","path","starts","with"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["path-ends-with","contains-path","normalize-path"]},"lint":{"reflinks":true}},"gitHead":"8f3d31a61a10b1733b3f7225ec33551a347ca68d","_id":"path-starts-with@1.0.0","_shasum":"b28243015e8b138de572682ac52da42e646ad84e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"b28243015e8b138de572682ac52da42e646ad84e","size":3329,"noattachment":false,"key":"/path-starts-with/-/path-starts-with-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/path-starts-with/download/path-starts-with-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/path-starts-with-1.0.0.tgz_1492411318160_0.7261213778983802"},"directories":{},"publish_time":1492411320036,"_hasShrinkwrap":false,"_cnpm_publish_time":1492411320036}},"readme":"# path-starts-with [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/path-starts-with.svg?style=flat)](https://www.npmjs.com/package/path-starts-with) [![NPM monthly downloads](https://img.shields.io/npm/dm/path-starts-with.svg?style=flat)](https://npmjs.org/package/path-starts-with) [![NPM total downloads](https://img.shields.io/npm/dt/path-starts-with.svg?style=flat)](https://npmjs.org/package/path-starts-with) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/path-starts-with.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/path-starts-with)\n\n> Returns true if a filepath starts with the given string. Works with windows and posix/unix paths.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save path-starts-with\n```\n\n## Usage\n\n```js\nvar startsWith = require('path-starts-with');\n\nconsole.log(startsWith('foo/bar', 'foo')); //=> true\nconsole.log(startsWith('foo/bar', 'bar')); //=> false\n```\n\n## Negation\n\nPrefix the substring with `!` to return true when the path _does not_ start with the substring.\n\n```js\nconsole.log(startsWith('foo/bar', '!foo')); //=> false\nconsole.log(startsWith('foo/bar', '!bar')); //=> true\n```\n\n## options\n\n### options.nocase\n\n**Type**: `boolean`\n\n**Default**: `false`\n\nDisable case sensitivity.\n\n```js\nstartsWith('foo/bar', 'FOO');                 \n//=> false\nstartsWith('foo/bar', 'FOO', {nocase: true}); \n//=> true\n```\n\n### options.partialMatch\n\n**Type**: `boolean`\n\n**Default**: `false`\n\nAllow partial matches:\n\n```js\nstartsWith('foobar', 'foo');  //=> false                 \nstartsWith('foo.bar', 'foo'); //=> false                 \n\nstartsWith('foobar', 'foo', {partialMatch: true});  //=> true \nstartsWith('foo.bar', 'foo', {partialMatch: true}); //=> true \n```\n\n## Comparison behavior\n\n### Windows paths\n\nBackslashes are converted to forward slashes before the comparison is done. Thus, both of the following would be `true`:\n\n```js\nconsole.log(startsWith('foo\\\\bar', 'foo/bar')); //=> true\nconsole.log(startsWith('foo/bar', 'foo\\\\bar')); //=> true\n```\n\n### Leading dot-slash\n\nLeading `./` is stripped from both the filepath and substring. Thus, both of the following would be `true`:\n\n```js\nconsole.log(startsWith('./foo/bar', 'foo')); //=> true\nconsole.log(startsWith('foo/bar', './foo')); //=> true\n```\n\n### Leading slashes\n\nWhen the substring is prefixed with leading slashes, _the number of leading slashes_ must match exactly.\n\n```js\nconsole.log(startsWith('/foo', '/foo'));      //=> true\nconsole.log(startsWith('/foo/bar', '/foo'));  //=> true\n\nconsole.log(startsWith('/foo/bar', '//foo')); //=> false\nconsole.log(startsWith('//foo/bar', '/foo')); //=> false\n```\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\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 && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\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 && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path \"Return true if a file path contains the given path.\")\n* [normalize-path](https://www.npmjs.com/package/normalize-path): Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes… [more](https://github.com/jonschlinkert/normalize-path) | [homepage](https://github.com/jonschlinkert/normalize-path \"Normalize slashes in a file path to be posix/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\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2019, [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.8.0, on April 29, 2019._","_attachments":{},"homepage":"https://github.com/jonschlinkert/path-starts-with","bugs":{"url":"https://github.com/jonschlinkert/path-starts-with/issues"},"license":"MIT"}