UNPKG

@empathyco/x-components

Version:
16 lines (14 loc) 489 B
/** * Get one parameter value from the url. * * @param param - The parameter to get from the url. * @returns The parameter value from the url. * @public */ const getURLParameter = (param) => { const regex = new RegExp(`[?|&]${param}=([^&;]+?)(&|#|;|$)`); const paramValue = regex.exec(window.location.href); return paramValue ? decodeURIComponent(paramValue[1].replace(/\+/g, '%20')) : null; }; export { getURLParameter }; //# sourceMappingURL=get-url-parameters.js.map