selectors.ts (418B)
1 import { HotListState } from "./hotlists"; 2 3 const createEmptyHotlist = (bufferId: string) => ({ 4 buffer: bufferId, 5 count: [0, 0, 0, 0], 6 message: 0, 7 privmsg: 0, 8 highlight: 0, 9 sum: 0 10 }); 11 12 export const getHotlistForBufferId = ( 13 state: HotListState, 14 bufferId: string 15 ): Hotlist => { 16 if (bufferId && state[bufferId]) { 17 return state[bufferId]; 18 } else { 19 return createEmptyHotlist(bufferId); 20 } 21 };