(name)
| 278 | } |
| 279 | |
| 280 | function getQueryParameter(name) { |
| 281 | const loc = (global.window || global).location; |
| 282 | if (!loc || !loc.search) { |
| 283 | return null; |
| 284 | } |
| 285 | const search = String(loc.search).charAt(0) === "?" ? String(loc.search).substring(1) : String(loc.search); |
| 286 | if (!search) { |
| 287 | return null; |
| 288 | } |
| 289 | const pairs = search.split("&"); |
| 290 | for (let i = 0; i < pairs.length; i++) { |
| 291 | const part = pairs[i]; |
| 292 | if (!part) { |
| 293 | continue; |
| 294 | } |
| 295 | const eq = part.indexOf("="); |
| 296 | const rawKey = eq >= 0 ? part.substring(0, eq) : part; |
| 297 | if (decodeURIComponent(rawKey.replace(/\+/g, " ")) !== name) { |
| 298 | continue; |
| 299 | } |
| 300 | const rawValue = eq >= 0 ? part.substring(eq + 1) : ""; |
| 301 | return decodeURIComponent(rawValue.replace(/\+/g, " ")); |
| 302 | } |
| 303 | return null; |
| 304 | } |
| 305 | |
| 306 | // Gate for port.js's PARPAR:DIAG:* and PARPAR:DIAG:FALLBACK:* log emissions. |
| 307 | // Opt-in via ``?parparDiag=1`` (same toggle CI uses). Before this gate every |
no test coverage detected