lib/formatDeckAsShortCards.js
function formatDeckAsShortCards(deck) {
    var newDeck = {
        _id: deck._id,
        name: deck.name,
        username: deck.username,
        lastUpdated: deck.lastUpdated,
        faction: { name: deck.faction.name, value: deck.faction.value }
    };

    if (deck.agenda) {
        newDeck.agenda = { code: deck.agenda.code };
    }

    newDeck.bannerCards = (deck.bannerCards || []).map(function (card) {
        return { code: card.code };
    });
    newDeck.drawCards = formatCards(deck.drawCards || []);
    newDeck.plotCards = formatCards(deck.plotCards || []);
    newDeck.rookeryCards = formatCards(deck.rookeryCards || []);

    return newDeck;
}
function formatDeckAsShortCards(deck) {
    var newDeck = {
        _id: deck._id,
        name: deck.name,
        username: deck.username,
        lastUpdated: deck.lastUpdated,
        faction: { name: deck.faction.name, value: deck.faction.value }
    };

    if (deck.agenda) {
        newDeck.agenda = { code: deck.agenda.code };
    }

    newDeck.bannerCards = (deck.bannerCards || []).map(function (card) {
        return { code: card.code };
    });
    newDeck.drawCards = formatCards(deck.drawCards || []);
    newDeck.plotCards = formatCards(deck.plotCards || []);
    newDeck.rookeryCards = formatCards(deck.rookeryCards || []);

    return newDeck;
}
function formatDeckAsShortCards ( deck ) { var newDeck = { _id : deck . _id , name : deck . name , username : deck . username , lastUpdated : deck . lastUpdated , faction : { name : deck . faction . name , value : deck . faction . value } } ; if ( deck . agenda ) { newDeck . agenda = { code : deck . agenda . code } ; } newDeck . bannerCards = ( deck . bannerCards || [ ] ) . map ( function ( card ) { return { code : card . code } ; } ) ; newDeck . drawCards = formatCards ( deck . drawCards || [ ] ) ; newDeck . plotCards = formatCards ( deck . plotCards || [ ] ) ; newDeck . rookeryCards = formatCards ( deck . rookeryCards || [ ] ) ; return newDeck ; }
Creates a clone of the existing deck with only card codes instead of full
card data.
Creates a clone of the existing deck with only card codes instead of full card data .