Files
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

16 lines
438 B
TypeScript

import type { ContactItem } from '../types';
export type ChatPeer = { wxid: string; name: string; avatar: string };
export function resolveChatPeerByWxid(
wxid: string | null | undefined,
contacts: ContactItem[],
): ChatPeer | null {
if (!wxid) return null;
const contact = contacts.find(c => c.wxid === wxid);
if (contact) {
return { wxid: contact.wxid, name: contact.name, avatar: contact.avatar };
}
return null;
}