@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
62 lines (61 loc) • 3.61 kB
TypeScript
/***
* d88888b d8b db .o88b. .d88b. d8888b. d88888b d8888b. d88888b .o88b. .d88b. d8888b. d88888b .d8888. d888888b d8888b. d888888b d8b db d888b
* 88' 888o 88 d8P Y8 .8P Y8. 88 `8D 88' 88 `8D 88' d8P Y8 .8P Y8. 88 `8D 88' 88' YP `~~88~~' 88 `8D `88' 888o 88 88' Y8b
* 88ooooo 88V8o 88 8P 88 88 88 88 88ooooo 88 88 88ooooo 8P 88 88 88 88 88ooooo `8bo. 88 88oobY' 88 88V8o 88 88
* 88~~~~~ 88 V8o88 8b 88 88 88 88 88~~~~~ 88 88 88~~~~~ 8b 88 88 88 88 88~~~~~ `Y8b. 88 88`8b 88 88 V8o88 88 ooo
* 88. 88 V888 Y8b d8 `8b d8' 88 .8D 88. 88 .8D 88. Y8b d8 `8b d8' 88 .8D 88. db 8D 88 88 `88. .88. 88 V888 88. ~8~
* Y88888P VP V8P `Y88P' `Y88P' Y8888D' Y88888P Y8888D' Y88888P `Y88P' `Y88P' Y8888D' Y88888P `8888Y' YP 88 YD Y888888P VP V8P Y888P
*
*
*/
export declare function encodeDecodeString(str: string, doThis: 'encode' | 'decode'): string;
/***
* .o88b. db d88888b .d8b. d8b db .d8888. d8888b. db d888888b .d8888. d888888b db db d8888b. db
* d8P Y8 88 88' d8' `8b 888o 88 88' YP 88 `8D 88 `88' 88' YP `~~88~~' 88 88 88 `8D 88
* 8P 88 88ooooo 88ooo88 88V8o 88 `8bo. 88oodD' 88 88 `8bo. 88 88 88 88oobY' 88
* 8b 88 88~~~~~ 88~~~88 88 V8o88 `Y8b. 88~~~ 88 88 `Y8b. 88 88 88 88`8b 88
* Y8b d8 88booo. 88. 88 88 88 V888 db 8D 88 88booo. .88. db 8D 88 88b d88 88 `88. 88booo.
* `Y88P' Y88888P Y88888P YP YP VP V8P `8888Y' 88 Y88888P Y888888P `8888Y' YP ~Y8888P' 88 YD Y88888P
*
*
*/
/**
* SharePoint automatically removes characters from library names
*
* @param str
*/
export declare function cleanSPListURL(str: string): string;
/***
* .o88b. db d88888b .d8b. d8b db db db d8888b. db
* d8P Y8 88 88' d8' `8b 888o 88 88 88 88 `8D 88
* 8P 88 88ooooo 88ooo88 88V8o 88 88 88 88oobY' 88
* 8b 88 88~~~~~ 88~~~88 88 V8o88 88 88 88`8b 88
* Y8b d8 88booo. 88. 88 88 88 V888 88b d88 88 `88. 88booo.
* `Y88P' Y88888P Y88888P YP YP VP V8P ~Y8888P' 88 YD Y88888P
*
*
*/
export declare function cleanURL(originalURL: String): string;
/**
* NOTE This only works when the /sites/ you are refering to is in the same tenant
* @param relUrl
*/
export declare function getFullUrlFromSlashSitesUrl(relUrl: string, showConsole?: boolean): string;
export declare function getSiteCollectionUrlFromLink(link: string): string;
export declare const regexMultiFwdSlash: RegExp;
export declare const regexInsecureProtocall: RegExp;
export declare const regexSecureProtocall: RegExp;
export declare const regexAnyProtocoll: RegExp;
/**
* Copied from SecureScript
*
* This coverts any Url to serverRelativeUrl style (starts with /sites/) if it's on tenant ( removes the current hostname )
* The special part about it is it also:
* handles different cAsEs of the protocall and origin
* cleans up cases with extra // in back part of url: like /sites/test///anotherUrl
* handles both http: and https: links
*
* @param url
* @returns
*/
export declare function standardizeLocalLink(url: string): string;