(query: string)
| 1094 | * (`入口`, `로그인`), deduped, at most 16. |
| 1095 | */ |
| 1096 | export function exploreQueryTokens(query: string): string[] { |
| 1097 | const FILE_EXT = /\.(?:java|kt|kts|ts|tsx|js|jsx|mjs|cjs|cs|py|go|rb|php|swift|rs|cpp|cc|cxx|c|h|hpp|scala|lua|dart|vue|svelte|astro|erl|hrl)$/i; |
| 1098 | return [...new Set( |
| 1099 | query.split(/[\s,()[\]]+/) |
| 1100 | .map((t) => t.replace(FILE_EXT, '').trim()) |
| 1101 | .flatMap(splitAtCjkSwitches) |
| 1102 | .filter(isQueryNameToken) |
| 1103 | )].slice(0, 16); |
| 1104 | } |
| 1105 | |
| 1106 | /** |
| 1107 | * A query token written the way code names things — `ChangelogParser`, |
no test coverage detected