@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
18 lines • 894 B
JavaScript
/**
* The purpose of this function is to update the listTitle and webRelativeLink and make it easier to just
* pass in the listPickerValue which is of format /sites/SiteUrl/lists/ListTitle and have it do the rest.
* I separated this little code because it can then be reused across other functions to create other SourceProps
*
* @param listTitle
* @param webUrl
* @param Source
*/
export function updateSourcePerListPickerName(listTitle, webUrl, Source) {
if (listTitle && listTitle.indexOf(webUrl) === 0) { // Fix if listTitle is really the listPicker
let wRL = listTitle.replace(webUrl, '');
Source.listTitle = wRL.toLocaleLowerCase().indexOf('lists/') === 0 ? wRL.substring(6) : wRL;
Source.listName = `${Source.listTitle}`;
Source.webRelativeLink = `/${wRL}`;
}
}
//# sourceMappingURL=updateSourcePerListPickerName.js.map