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

Function paramsGet

packages/analytics-util-params/src/paramsGet.js:10–24  ·  view source on GitHub ↗
(param, url)

Source from the content-addressed store, hash-verified

8 * @return {string} match
9 */
10export default function paramsGet(param, url) {
11 var e
12 const map = {}
13 while (e = queryRegex.exec(url)) { // eslint-disable-line
14 let KEY = decode(e[1])
15 const VALUE = format(decode(e[3]))
16 if (KEY.substring(KEY.length - 2) === '[]') {
17 const k = KEY.substring(0, KEY.length - 2)
18 if (k === param) map[param] = (map[param] || []).concat(VALUE)
19 } else {
20 if (KEY === param && !map[param]) map[param] = VALUE
21 }
22 }
23 return map[param]
24}

Callers

nothing calls this directly

Calls 2

formatFunction · 0.70
decodeFunction · 0.50

Tested by

no test coverage detected