All files / games/mc/src/sections data.ts

100% Statements 19/19
75% Branches 3/4
100% Functions 4/4
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  6x 6x 6x 6x 4x   4x 1x 1x 1x   1x   4x   4x 2x 2x   4x   4x   4x   6x          
import { Deck, Hero, ModularSet, Scenario } from "../@models";
import { createSection, createTitle } from "../helper";
 
export const loadData = (body: HTMLBodyElement, heroes: Hero[], modules: ModularSet[], scenarios: Scenario[], decks: Deck[]): void => {
    createTitle("Data", body);
 
    // display heroes
    const heroesData = heroes.map((hero) => {
        hero.name = `${hero.name}`;
E
        if (null != hero.aspects) {
            hero.name = `${hero.name} (${hero.aspects.join("/")})`;
        }
 
        return hero;
    });
    createSection("Heroes", heroesData, body);
    // display Scenarios
    const scenariosData = scenarios.map((scenario) => {
        scenario.name = `${scenario.name} (${
            null != scenario.modularSets ? scenario.modularSets.map((modularSet) => modularSet.name).join(", ") : ""
        })`;
 
        return scenario;
    });
    createSection("Scenarios", scenariosData, body);
    // display Modular sets
    createSection("Modular Encounter Sets", modules, body);
    // Decks
    createSection("Decks", decks, body);
};