( params: ParsedUrlQuery | undefined )
| 2 | import { ROOT_TOPIC_ID } from './constants' |
| 3 | |
| 4 | export const searchStringFromParams = ( |
| 5 | params: ParsedUrlQuery | undefined |
| 6 | ): string => { |
| 7 | if (!params) return `in:${ROOT_TOPIC_ID}` |
| 8 | |
| 9 | const { q, id } = params |
| 10 | const parentTopicId = id || ROOT_TOPIC_ID |
| 11 | if (!q) return `in:${parentTopicId}` |
| 12 | return `in:${parentTopicId} ${decodeURIComponent(q as string)}` |
| 13 | } |
no outgoing calls
no test coverage detected