@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
23 lines (21 loc) • 849 B
text/typescript
type URLCache = Map<string, URL>;
type RegExpCache = Map<string, RegExp>;
declare function isSafeUrl(url: unknown): boolean;
declare function replaceDomainPrefix(originalUrl: string, prefix: string): string;
type ReplaceDomainOptions = {
encoded?: boolean;
urlsCache?: URLCache;
regexpsCache?: RegExpCache;
};
declare function getWildcardDomain(domain: string, cache?: URLCache): {
wildcardDomain: string;
prefix: string;
};
declare function replaceDomain(source: string, from: string, to: string, options?: ReplaceDomainOptions): string;
type URLWithMeta = Readonly<URL> & {
isIP: boolean;
isSpecialIP: boolean;
isLocalhost: boolean;
};
declare function getUrlMeta(url: string): URLWithMeta | null;
export { type ReplaceDomainOptions, getUrlMeta, getWildcardDomain, isSafeUrl, replaceDomain, replaceDomainPrefix };