mirror of
https://github.com/balzack/databag.git
synced 2025-02-19 06:29:23 +00:00
22 lines
548 B
JavaScript
22 lines
548 B
JavaScript
|
export function getCardByGuid(cards, guid) {
|
||
|
let card = null;
|
||
|
cards.current.forEach((value, key, map) => {
|
||
|
if(value?.data?.cardProfile?.guid === guid) {
|
||
|
card = value;
|
||
|
}
|
||
|
});
|
||
|
return card;
|
||
|
}
|
||
|
|
||
|
export getProfileByGuid: (cards, guid) => {
|
||
|
const card = getCardByGuid(guid);
|
||
|
if (card?.data?.cardProfile) {
|
||
|
const { name, handle, imageSet } = card.data.cardProfile;
|
||
|
const revision = card.data.profileRevision;
|
||
|
const cardId = card.id;
|
||
|
return { cardId, revision, name, handle, imageSet, revision }
|
||
|
}
|
||
|
return {};
|
||
|
}
|
||
|
|