mirror of
https://github.com/balzack/databag.git
synced 2025-02-15 13:09:17 +00:00
21 lines
495 B
JavaScript
21 lines
495 B
JavaScript
export function getCardByGuid(cards, guid) {
|
|
let card = null;
|
|
cards.forEach((value, key, map) => {
|
|
if(value?.data?.cardProfile?.guid === guid) {
|
|
card = value;
|
|
}
|
|
});
|
|
return card;
|
|
}
|
|
|
|
export function getProfileByGuid(cards, guid) {
|
|
const card = getCardByGuid(cards, guid);
|
|
if (card?.data?.cardProfile) {
|
|
const { name, handle, imageSet, node } = card.data.cardProfile;
|
|
const cardId = card.id;
|
|
return { cardId, name, handle, imageSet, node }
|
|
}
|
|
return {};
|
|
}
|
|
|