Members
[undefined]
currentPath
currentPath
env
filepath
fs
path
prefix
prefix
prefix
prefix
result
result
result
segments
Methods
commonPrefix(paths) → {string}
Find the common prefix for an array of paths. If there is a common prefix, a trailing separator
is appended to the prefix. Relative paths are resolved relative to the current working directory.
For example, assuming that the current working directory is `/Users/jsdoc`:
+ For the single path `foo/bar/baz/qux.js`, the common prefix is `foo/bar/baz/`.
+ For paths `foo/bar/baz/qux.js`, `foo/bar/baz/quux.js`, and `foo/bar/baz.js`, the common prefix
is `/Users/jsdoc/foo/bar/`.
+ For paths `../jsdoc/foo/bar/baz/qux/quux/test.js`, `/Users/jsdoc/foo/bar/bazzy.js`, and
`../../Users/jsdoc/foo/bar/foobar.js`, the common prefix is `/Users/jsdoc/foo/bar/`.
+ For paths `foo/bar/baz/qux.js` and `../../Library/foo/bar/baz.js`, there is no common prefix,
and an empty string is returned.
Parameters:
| Name | Type | Description |
|---|---|---|
paths |
Array.<string> | The paths to search for a common prefix. |
Returns:
The common prefix, or an empty string if there is no common prefix.
- Type
- string
getResourcePath(filepath, filenameopt) → {string}
Retrieve the fully qualified path to the requested resource.
If the resource path is specified as a relative path, JSDoc searches for the resource in the
following locations, in this order:
1. The current working directory
2. The directory where the JSDoc configuration file is located
3. The JSDoc directory
4. Anyplace where `require()` can find the resource (for example, in your project's
`node_modules` directory)
If the resource path is specified as a fully qualified path, JSDoc searches for the resource in
the following locations, in this order:
1. The resource path
2. Anyplace where `require()` can find the resource (for example, in your project's
`node_modules` directory)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
filepath |
string | The path to the requested resource. May be an absolute path; a path relative to the JSDoc directory; or a path relative to the current working directory. | |
filename |
string |
<optional> |
The filename of the requested resource. |
Returns:
The fully qualified path to the requested resource. Includes the filename if one
was provided.
- Type
- string