UNPKG

500 BJavaScriptView Raw
1import { stringIsNullOrEmpty } from "@pnp/core";
2export function extractWebUrl(candidateUrl) {
3 if (stringIsNullOrEmpty(candidateUrl)) {
4 return "";
5 }
6 let index = candidateUrl.indexOf("_api/");
7 if (index < 0) {
8 index = candidateUrl.indexOf("_vti_bin/");
9 }
10 if (index > -1) {
11 return candidateUrl.substring(0, index);
12 }
13 // if all else fails just give them what they gave us back
14 return candidateUrl;
15}
16//# sourceMappingURL=extract-web-url.js.map
\No newline at end of file