ai-tube / src /lib /getCollectionKey.ts
jbilcke-hf's picture
jbilcke-hf HF staff
add like button and report button
8f2b05f
raw
history blame
No virus
315 Bytes
// compute a "collection key" that we can use in our useEffects and such
export function getCollectionKey(input?: any): string {
const collection: any[] = Array.isArray(input) ? input : [`${input || ""}`]
return (collection || []).map((v: any) => (v as any)?.id || JSON.stringify(v)).filter(x => x).join("--")
}