@kwiz/common
Version:
KWIZ common utilities and helpers for M365 platform
47 lines (46 loc) • 2.57 kB
TypeScript
import { IDictionary } from "../types/common.types";
/**
* Get query string parameter by name
* @param name name of parameter
* @param url optional, url. if not sent - current window.location.href will be used
*/
export declare function getQueryStringParameter(param: string, url?: string, caseInSensitive?: boolean): string;
/**
* Get url hash parameter by name
* @param name name of parameter
* @param url optional, url. if not sent - current window.location.href will be used
*/
export declare function getHashParameter(param: string, url?: string, caseInSensitive?: boolean): string;
/** return a value of a parameter from a key/value string like: key=value&key2=value2 */
export declare function getParameterValue(param: string, keyValueString: string, caseInSensitive?: boolean): string;
/**
* Make full url relative to current page location
* @param url
*/
export declare function makeFullUrl(url: string, baseUrl?: string): string;
/** if the url is the same, only different hash parameter - reload the page. otherwise - navigate to the page */
export declare function navigateOrReload(urlWithHash: string): void;
/** baseUrl is optional full or server relative URL to build folder relative urls from. */
export declare function makeServerRelativeUrl(url: string, baseUrl?: string): string;
/** Normalizes URL ending, end with or without slash */
export declare function normalizeUrl(url: string, endWithSlash?: boolean): string;
/**
* Returns the extension for a specified url string. Requires the URL polyfill for IE.
*/
export declare function getURLExtension(url: string): string;
export declare function isDataUrl(url: string): boolean;
export declare function setUrlKeyValue(keyName: string, keyValue: string, bEncode: boolean, url?: string): string;
export declare function removeUrlKeyValue(keyName: string, url?: string, bCaseInsensitive?: boolean): string;
/**
* Returns encoded string from encodeURIComponent with single quote replaced with %27 or %27%27
*/
export declare function encodeURIComponentEX(str: any, options?: {
/** use this flag when making a REST requst, and encoding a parameter surrounded by 'param'
* for each level of '' your param is sorounded with
* example: filename('par'am') > send 2 to make it filename('par''am')
* example 2: sheet(' ''par'am'' ') > send 4 to make it sheet(' ''par''''am'' ')
*/
singleQuoteMultiplier?: number;
}): string;
export declare function parseQueryString(url: string): IDictionary<string>;
export declare function parseHash(url: string): IDictionary<string>;