diff --git a/doc/api/path.md b/doc/api/path.md index e5d6fd7ef68304..5b433b88a9d7bd 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -165,6 +165,22 @@ path.dirname('/foo/bar/baz/asdf/quux'); A [`TypeError`][] is thrown if `path` is not a string. +## `path.escapeGlob(pattern)` + + + +* `pattern` {string} +* Returns: {string} + +The `path.escapeGlob()` method escapes glob characters in a `pattern`. + +```js +path.escapeGlob('foo*bar'); +// Returns: 'foo[*]bar' +``` + ## `path.extname(path)` - -* `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)` + +* `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.normalize(path)` + +* `pattern` {string} +* Returns: {string} + +The `path.unescapeGlob()` method unescapes the given glob pattern. + +```js +path.unescapeGlob('foo[*]bar'); +// Returns: 'foo*bar' +``` + ## `path.win32`