This commit is contained in:
2026-05-18 09:43:29 +12:00
parent b950229003
commit 6ff970015f
189 changed files with 18603 additions and 2727 deletions
+7 -4
View File
@@ -3,11 +3,14 @@ export function numericPrice(price: string): number {
return Number.isFinite(value) ? value : Number.POSITIVE_INFINITY;
}
export function decoratePlans<T extends { price: string }>(plans: T[]) {
const sorted = [...plans]
.map((plan, index) => ({ plan, index, value: numericPrice(plan.price) }))
.sort((a, b) => a.value - b.value || a.index - b.index);
export function decoratePlans<T extends { price: string; period: string }>(plans: T[]) {
const enriched = plans.map((plan, index) => ({
plan,
index,
value: numericPrice(plan.price)
}));
const sorted = [...enriched].sort((a, b) => a.value - b.value || a.index - b.index);
const cheapestIndex = sorted[0]?.index ?? -1;
const mobileOrder = new Map(sorted.map((entry, order) => [entry.index, order]));