INNER CODE UNIT · JavaScript

n

Manavarya09/design-extract · src/gallery/index.js:48

      const n = seen.get(item.slug) + 1;
      seen.set(item.slug, n);
      item.slug = `${item.slug}-${n}`;
    } else {
      seen.set(item.slug, 1);
    }
    items.push(item);
  }

  items.sort((a, b) => (b.overall ?? -1) - (a.overall ?? -1));

  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,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…