url-normalize
Version:
Normalize URLs to a standardized form. HTTPS by default, flexible configuration, custom protocols, domain extraction, humazing URL, and punycode support. Both CJS & ESM modules available.
26 lines (24 loc) • 1.11 kB
text/typescript
type Options = {
auth?: boolean;
customProtocol?: boolean;
defaultProtocol?: string;
filterSearch?: (key: string, value: string) => boolean;
forceProtocol?: string;
fragment?: boolean;
index?: boolean;
port?: boolean;
protocol?: boolean;
search?: boolean;
sortSearch?: boolean;
textFragment?: boolean;
unicode?: boolean;
www?: boolean;
};
declare const urlNormalizeOrFail: (url: string, options?: Options) => string;
declare const urlNormalize: (url?: string | null, options?: Options) => string | null;
declare const createUrlNormalize: (baseOptions: Options) => (url: string, opts?: Options) => string | null;
declare const extractDomainOrFail: (url: string) => string;
declare const extractDomain: (url?: string | null) => string | null;
declare const humanizeUrlOrFail: (url: string, options?: Options) => string;
declare const humanizeUrl: (url?: string | null, options?: Options) => string | null;
export { type Options, createUrlNormalize, extractDomain, extractDomainOrFail, humanizeUrl, humanizeUrlOrFail, urlNormalize, urlNormalizeOrFail };