UNPKG

599 BTypeScriptView Raw
1export interface Options {
2 /**
3 Prepend `https://` instead of `http://`.
4
5 @default true
6 */
7 readonly https?: boolean;
8}
9
10/**
11Prepend `https://` to humanized URLs like `sindresorhus.com` and `localhost`.
12
13@param url - The URL to prepend `https://` to.
14
15@example
16```
17import prependHttp from 'prepend-http';
18
19prependHttp('sindresorhus.com');
20//=> 'https://sindresorhus.com'
21
22prependHttp('localhost', {https: false});
23//=> 'http://localhost'
24
25prependHttp('https://sindresorhus.com');
26//=> 'https://sindresorhus.com'
27```
28*/
29export default function prependHttp(url: string, options?: Options): string;