UNPKG

@flex-development/pathe

Version:

Universal drop-in replacement for node:path

61 lines (60 loc) 1.62 kB
/** * @file toPath * @module pathe/lib/toPath */ import type { ToPathOptions } from '@flex-development/pathe'; export default toPath; /** * Convert `input` to a path. * * @see {@linkcode ToPathOptions} * * @category * utils * * @this {void} * * @param {URL | string} input * The {@linkcode URL}, URL string, or path to convert * @param {ToPathOptions | null | undefined} [options] * Conversion options * @return {string} * `input` as path */ declare function toPath(this: void, input: URL | string, options?: ToPathOptions | null | undefined): string; /** * Convert a list of inputs to paths. * * @see {@linkcode ToPathOptions} * * @category * utils * * @this {void} * * @param {ReadonlyArray<URL | string>} list * The list of {@linkcode URL}s, URL strings, or paths to convert * @param {ToPathOptions | null | undefined} [options] * Conversion options * @return {string[]} * List of paths */ declare function toPath(this: void, list: readonly (URL | string)[], options?: ToPathOptions | null | undefined): string[]; /** * Convert inputs to paths. * * @see {@linkcode ToPathOptions} * * @category * utils * * @this {void} * * @param {ReadonlyArray<URL | string> | URL | string} value * The {@linkcode URL}, URL string, or path to convert, or list of such values * @param {ToPathOptions | null | undefined} [options] * Conversion options * @return {string[] | string} * `value` as path or new list of paths */ declare function toPath(this: void, value: readonly (URL | string)[] | URL | string, options?: ToPathOptions | null | undefined): string[] | string;