UNPKG

@flex-development/pathe

Version:

Universal drop-in replacement for node:path

42 lines (41 loc) 1.28 kB
/** * @file format * @module pathe/lib/format */ import type { FormatInputPathObject } from '@flex-development/pathe'; /** * Get a path string from an object. * * This is the opposite of {@linkcode parse}. * * When adding properties to `pathObject`, there are combinations where one * property has priority over another: * * - `pathObject.root` is ignored if `pathObject.dir` is provided * - `pathObject.ext` and `pathObject.name` are ignored if `pathObject.base` * exists * * @see {@linkcode FormatInputPathObject} * * @category * core * * @this {void} * * @param {FormatInputPathObject | null | undefined} pathObject * The path object to handle * @param {string | null | undefined} [pathObject.base] * File name including extension (if any) * @param {string | null | undefined} [pathObject.dir] * Directory name or full directory path * @param {string | null | undefined} [pathObject.ext] * File extension (if any) * @param {string | null | undefined} [pathObject.name] * File name without extension (if any) * @param {string | null | undefined} [pathObject.root] * Root of path * @return {string} * Path string */ declare function format(this: void, pathObject: FormatInputPathObject | null | undefined): string; export default format;