mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
17 lines
581 B
TypeScript
17 lines
581 B
TypeScript
import type { SubsonicPlaylist } from '@/lib/api/subsonicTypes';
|
|
|
|
/** True when pathname is the Playlists browse route (`/playlists`). */
|
|
export function isPlaylistsBrowsePath(pathname: string): boolean {
|
|
return pathname === '/playlists';
|
|
}
|
|
|
|
/** Scoped Playlists text search — playlist name only. */
|
|
export function filterPlaylistsByNameQuery(
|
|
playlists: SubsonicPlaylist[],
|
|
query: string,
|
|
): SubsonicPlaylist[] {
|
|
const needle = query.trim().toLowerCase();
|
|
if (!needle) return playlists;
|
|
return playlists.filter(p => (p.name ?? '').toLowerCase().includes(needle));
|
|
}
|