@flex-development/pathe
Version:
Universal drop-in replacement for node:path
36 lines (35 loc) • 1.06 kB
text/typescript
/**
* @file relative
* @module pathe/lib/relative
*/
import type { RelativeOptions } from '@flex-development/pathe';
export default relative;
/**
* Get the relative path from `from` to `to` based on the current working
* directory.
*
* If `from` and `to` resolve to the same path (after calling
* {@linkcode resolveWith} on each), a zero-length string is returned.
*
* If a zero-length string is passed as `from` or `to`, the current working
* directory will be used instead of the zero-length strings.
*
* @see {@linkcode RelativeOptions}
*
* @todo url support
*
* @category
* core
*
* @this {void}
*
* @param {string[] | string} from
* Start path or path segments
* @param {string[] | string} to
* Destination path or path segments
* @param {RelativeOptions | null | undefined} [options]
* Relative path generation options
* @return {string}
* Relative path from `from` to `to`
*/
declare function relative(this: void, from: string[] | string, to: string[] | string, options?: RelativeOptions | null | undefined): string;