contains-path NPM version

Return true if a file path contains the given path.

Install

Install with npm

sh $ npm i contains-path --save

Usage

js var contains = require('contains-path');

true

All of the following return true:

js containsPath('./a/b/c', 'a'); containsPath('./a/b/c', 'a/b'); containsPath('./b/a/b/c', 'a/b'); containsPath('/a/b/c', '/a/b'); containsPath('/a/b/c', 'a/b'); containsPath('a', 'a'); containsPath('a/b/c', 'a'); //=> true

false

All of the following return false:

js containsPath('abc', 'a'); containsPath('abc', 'a.md'); containsPath('./b/a/b/c', './a/b'); containsPath('./b/a/b/c', './a'); containsPath('./b/a/b/c', '/a/b'); containsPath('/b/a/b/c', '/a/b'); //=> false

Related projects

Running tests

Install dev dependencies:

sh $ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on July 07, 2015.