diff --git a/doc/api/path.md b/doc/api/path.md index c7a999cbb1ec22..ef710106efd23b 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -279,6 +279,29 @@ path.format({ // Returns: 'C:\\path\\dir\\file.txt' ``` +## `path.matchesGlob(path, pattern)` + + + +> Stability: 1 - Experimental + +* `path` {string} The path to glob-match against. +* `pattern` {string} The glob to check the path against. +* Returns: {boolean} Whether or not the `path` matched the `pattern`. + +The `path.matchesGlob()` method determines if `path` matches the `pattern`. + +For example: + +```js +path.matchesGlob('/foo/bar', '/foo/*'); // true +path.matchesGlob('/foo/bar*', 'foo/bird'); // false +``` + +A [`TypeError`][] is thrown if `path` or `pattern` are not strings. + ## `path.isAbsolute(path)`