## Usage ```js var startsWith = require('{%= name %}'); console.log(startsWith('foo/bar', 'foo')); //=> true console.log(startsWith('foo/bar', 'bar')); //=> false ``` ## Negation Prefix the substring with `!` to return true when the path _does not_ start with the substring. ```js console.log(startsWith('foo/bar', '!foo')); //=> false console.log(startsWith('foo/bar', '!bar')); //=> true ``` ## options ### options.nocase **Type**: `boolean` **Default**: `false` Disable case sensitivity. ```js startsWith('foo/bar', 'FOO'); //=> false startsWith('foo/bar', 'FOO', {nocase: true}); //=> true ``` ### options.partialMatch **Type**: `boolean` **Default**: `false` Allow partial matches: ```js startsWith('foobar', 'foo'); //=> false startsWith('foo.bar', 'foo'); //=> false startsWith('foobar', 'foo', {partialMatch: true}); //=> true startsWith('foo.bar', 'foo', {partialMatch: true}); //=> true ``` ## Comparison behavior ### Windows paths Backslashes are converted to forward slashes before the comparison is done. Thus, both of the following would be `true`: ```js console.log(startsWith('foo\\bar', 'foo/bar')); //=> true console.log(startsWith('foo/bar', 'foo\\bar')); //=> true ``` ### Leading dot-slash Leading `./` is stripped from both the filepath and substring. Thus, both of the following would be `true`: ```js console.log(startsWith('./foo/bar', 'foo')); //=> true console.log(startsWith('foo/bar', './foo')); //=> true ``` ### Leading slashes When the substring is prefixed with leading slashes, _the number of leading slashes_ must match exactly. ```js console.log(startsWith('/foo', '/foo')); //=> true console.log(startsWith('/foo/bar', '/foo')); //=> true console.log(startsWith('/foo/bar', '//foo')); //=> false console.log(startsWith('//foo/bar', '/foo')); //=> false ```