MCPcopy Create free account
hub / github.com/DavidWells/analytics / getSearchString

Function getSearchString

packages/analytics-utils/src/paramsParse.js:9–15  ·  view source on GitHub ↗

* Get search string from given url * @param {string} [url] - optional url string. If no url, window.location.search will be used * @return {string} url search string

(url)

Source from the content-addressed store, hash-verified

7 * @return {string} url search string
8 */
9function getSearchString(url) {
10 if (url) {
11 const p = url.match(/\?(.*)/)
12 return (p && p[1]) ? p[1].split('#')[0] : ''
13 }
14 return isBrowser && window.location.search.substring(1)
15}
16
17/**
18 * Parse url parameters into javascript object

Callers 1

paramsParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected