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

Function findMatchingQueryKey

components/lib/get-rest-code-samples.ts:243–254  ·  view source on GitHub ↗
(exampleObj: CodeExamples | CodeExamples[], matchKey: string)

Source from the content-addressed store, hash-verified

241// }
242// We need to find the matching key so this is using JSON.stringify to handle the "recursion" to search for the matching key.
243function findMatchingQueryKey(exampleObj: CodeExamples | CodeExamples[], matchKey: string) {
244 let match: string | null = null
245 JSON.stringify(exampleObj, (_, nestedValue) => {
246 if (nestedValue && Object.prototype.hasOwnProperty.call(nestedValue, matchKey)) {
247 match = nestedValue[matchKey]
248 }
249
250 return nestedValue
251 })
252
253 return match
254}
255
256function getRequiredQueryParamsPath(operation: Operation, codeSample: CodeSample) {
257 const requiredQueryParams = new URLSearchParams()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected