pages/ValuePartnership/PartnershipsPage/qrCodeLink.jsjavascript
/**
* Normalizes the `webLink` field found on partnership/ppt/filter-option
* entries (value-partnership-partnerships.json) into a URL the QR code can
* encode. `webLink` is stored inconsistently as either a plain string or a
* one-element array, and is sometimes an empty string when no link exists.
*
* @param {string|string[]} webLink
* @returns {string|null} The resolved URL, or `null` if none is set.
*/
export const resolveWebLink = (webLink) => {
const value = Array.isArray(webLink) ? webLink[0] : webLink;
return value || null;
};