Function joinUrlPaths

  • Joins all given arguments together as if they were paths of a URL. Preserves trailing slashes and removes consecutive slashes in the path. For more complex URL building, use buildUrl.

    Parameters

    • Rest...urlParts: readonly string[]

    Returns string

    import {joinUrlPaths} from 'url-vir';

    joinUrlPaths('https://example.com', 'path1', 'path2/', '/path3/');
    // `'https://example.com/path1/path2/path3/'`