MCPcopy Index your code
hub / github.com/github/docs / parseDebug

Function parseDebug

components/hooks/useQuery.ts:22–43  ·  view source on GitHub ↗
(debug: string | Array<string> | undefined)

Source from the content-addressed store, hash-verified

20}
21
22function parseDebug(debug: string | Array<string> | undefined) {
23 if (debug === '') {
24 // E.g. `?query=foo&debug` should be treated as truthy
25 return true
26 }
27
28 if (!debug) {
29 return false
30 }
31
32 // Now `router.query.debug` is either string or any array of strings
33 if (Array.isArray(debug)) {
34 debug = debug[0]
35 }
36
37 try {
38 debug = JSON.parse(debug)
39 return Boolean(debug)
40 } catch (e) {}
41
42 return false
43}

Callers 1

useQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected