file-path
Functions
- getFileName(file) ⇒
string Retrieves the file name. If the file name is '__index__', it returns 'index'.
- getFileFolder(file) ⇒
string Retrieves the folder of the file.
- computePaths(file, config) ⇒
object Computes the relative destination path and the absolute folder path in the destination directory.
getFileName(file) ⇒ string
Retrieves the file name. If the file name is '__index__', it returns 'index'.
Kind: global function
Returns: string - The name of the file.
| Param | Type | Description |
|---|---|---|
| file | DirectoryFile | The file object to retrieve the name from. |
Example
js
const file = {name: '__index__'};
const name = getFileName(file); // 'index'const file = {name: '__index__'};
const name = getFileName(file); // 'index'getFileFolder(file) ⇒ string
Retrieves the folder of the file.
Kind: global function
Returns: string - The folder of the file.
| Param | Type | Description |
|---|---|---|
| file | DirectoryFile | The file object to retrieve the folder from. |
Example
js
const file = {folder: '/src/components'};
const folder = getFileFolder(file); // '/src/components'const file = {folder: '/src/components'};
const folder = getFileFolder(file); // '/src/components'computePaths(file, config) ⇒ object
Computes the relative destination path and the absolute folder path in the destination directory.
Kind: global function
Returns: object - An object containing:
- relativePathDest: The relative path in the destination directory.
- folderInDest: The absolute path of the folder in the destination directory.
| Param | Type | Description |
|---|---|---|
| file | DirectoryFile | The file object to compute paths for. |
| config | ParserConfig | The configuration object containing source and documentation folders. |
Example
js
const file = {folder: '/src/components'};
const config = {srcFolder: '/src', docsFolder: '/docs'};
const paths = computePaths(file, config);const file = {folder: '/src/components'};
const config = {srcFolder: '/src', docsFolder: '/docs'};
const paths = computePaths(file, config);