INNER CODE UNIT · JavaScript
scored
Manavarya09/design-extract · src/gallery/index.js:59
const scored = items.filter(i => i.overall != null);
const stats = {
count: items.length,
scored: scored.length,
avg: scored.length ? Math.round(scored.reduce((s, i) => s + i.overall, 0) / scored.length) : null,
best: scored.length ? scored[0] : null,
worst: scored.length ? scored[scored.length - 1] : null,
};
return { items, stats };
}