File size: 414 Bytes
f24ad59
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import { LatentSearchMode } from "../v1/search/route"

export function parseLatentSearchMode(input?: any, defaultMode: LatentSearchMode = "basic"): LatentSearchMode {
  let mode = defaultMode
  try {
    let maybeMode = decodeURIComponent(`${input || ""}` || defaultMode).trim()
    mode = ["basic", "extended"].includes(maybeMode) ? (maybeMode as LatentSearchMode) : defaultMode
  } catch (err) {}
  return mode
}