(query: string)
| 1217 | * (`入口`, `로그인`), deduped, at most 16. |
| 1218 | */ |
| 1219 | export function exploreQueryTokens(query: string): string[] { |
| 1220 | 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; |
| 1221 | return [...new Set( |
| 1222 | query.split(/[\s,()[\]]+/) |
| 1223 | .map((t) => t.replace(FILE_EXT, '').trim()) |
| 1224 | .flatMap(splitAtCjkSwitches) |
| 1225 | .filter(isQueryNameToken) |
| 1226 | )].slice(0, 16); |
| 1227 | } |
| 1228 | |
| 1229 | /** |
| 1230 | * A query token written the way code names things — `ChangelogParser`, |
no test coverage detected