refactor: move functions

This commit is contained in:
Maël Gangloff
2024-08-22 01:44:50 +02:00
parent 7ece681d73
commit 5ae0b836a5
25 changed files with 244 additions and 215 deletions

View File

@@ -0,0 +1,11 @@
import {Entity} from "../api";
import vCard from "vcf";
export const entityToName = (e: { entity: Entity }): string => {
if (e.entity.jCard.length === 0) return e.entity.handle
const jCard = vCard.fromJSON(e.entity.jCard)
let name = e.entity.handle
if (jCard.data.fn && !Array.isArray(jCard.data.fn) && jCard.data.fn.valueOf() !== '') name = jCard.data.fn.valueOf()
return name
}