@selfcommunity/utils
Version:
Utilities to integrate a Community.
41 lines (40 loc) • 1.22 kB
TypeScript
/**
* Utility Url Replacer
* @param path
*/
export declare const urlReplacer: (path: string) => (params: object) => any;
/**
* Get domain
* @param url
*/
export declare const getDomain: (url: string) => string;
/**
* Check a str is a valid url pattern
* @param url
*/
export declare const isValidUrl: (url: string) => boolean;
/**
* Check a str is a valid list of urls separated by delimiter
* @param value
* @param delimiter
*/
export declare const isValidUrls: (value: string, delimiter: string) => boolean;
/**
* Append params
* @param baseUrl
* @param queryParams
*/
export declare function appendURLSearchParams(baseUrl: string, queryParams: Record<string, string | number>[]): string;
/**
* Take the application server's public key, which is Base64 URL-safe encoded,
* and convert it to a UInt8Array, because this is the expected input of the subscribe()
*/
export declare const urlB64ToUint8Array: (base64String: any) => Uint8Array;
/**
* Get a query string parameter
*/
export declare const getQueryStringParameter: (uri: any, key: any) => string;
/**
* Add or update a query string parameter
*/
export declare const updateQueryStringParameter: (uri: any, key: any, value: any) => any;