Docs/Skills and code/src/
src/metadata-utils.js
export function parseCount(value) {
if (typeof value === "number" && Number.isFinite(value)) {
return Math.round(value);
}
const text = String(value ?? "").trim().toLowerCase();
if (!text) return null;
const match = text.replace(/,/g, "").match(/([0-9]+(?:\.[0-9]+)?)\s*([km])?/i);
if (!match) return null;
const number = Number(match[1]);
if (!Number.isFinite(number)) return null;
const suffix = match[2]?.toLowerCase();
if (suffix === "k") return Math.round(number * 1_000);
if (suffix === "m") return Math.round(number * 1_000_000);
return Math.round(number);
}
export function normalizeText(value) {
return String(value ?? "")
.toLowerCase()
.replace(/[^a-z0-9]+/g, " ")
.trim()
.replace(/\s+/g, " ");
}
export function uniqueStrings(values) {
return [...new Set(
(values || [])
.map(value => String(value ?? "").trim())
.filter(Boolean)
)];
}
Shown as it is in the repository at build time (2026-11-03); the home directory appears as <home>. If this page and the file differ, the file is right. Back to the catalogue.