Skip to content

Welshman Docs / @welshman/lib / normalizeUrl

Function: normalizeUrl() ​

normalizeUrl(urlString, opts?): string

Defined in: packages/lib/src/normalize-url/index.ts:374

Normalize a URL.

URLs with custom protocols are not normalized and just passed through by default. Supported protocols are: https, http, file, and data.

Parameters ​

urlString ​

string

opts? ​

Options

Returns ​

string

Example ​

import normalizeUrl from 'normalize-url';

normalizeUrl('sindresorhus.com');
//=> 'http://sindresorhus.com'

normalizeUrl('//www.sindresorhus.com:80/../baz?b=bar&a=foo');
//=> 'http://sindresorhus.com/baz?a=foo&b=bar'