diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-06-26 21:55:46 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-06-26 21:55:46 -0700 |
| commit | 00d476a0e51629f06407aed035fbc001d3f6b114 (patch) | |
| tree | 016338cc4dacff54ba1cbe11fce063152cbd28ab /src/helpers/searchSong.ts | |
| parent | 84fbd4ee1e159b0426d664cc98a3dc7165d6381f (diff) | |
initial guess MV mode
Diffstat (limited to 'src/helpers/searchSong.ts')
| -rw-r--r-- | src/helpers/searchSong.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/helpers/searchSong.ts b/src/helpers/searchSong.ts index 62091b6..3bbecad 100644 --- a/src/helpers/searchSong.ts +++ b/src/helpers/searchSong.ts @@ -5,10 +5,11 @@ function fuzzyMatch(input: string): string { return input.toLowerCase().replace(/[^0-9a-z ]/gi, ""); } -export function searchSong(searchTerm: string): Song[] { +export function searchSong(searchTerm: string, pool?: Song[]): Song[] { const normalizedSearch = fuzzyMatch(searchTerm); + const source = pool ?? songs; //if no pool is provided, use the default k-heardle songs list - return songs + return source .filter((song: Song) => { const songName = fuzzyMatch(song.name); const songArtist = fuzzyMatch(song.artist); |
