From dac7d359a0bc44dc3d572969017585f650f26efa Mon Sep 17 00:00:00 2001 From: Oliver Salzburg Date: Sun, 8 Dec 2024 22:13:57 +0100 Subject: [PATCH] fix: Redundant coalesce --- source/format/count.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/format/count.ts b/source/format/count.ts index 09bd4c0..07125c2 100644 --- a/source/format/count.ts +++ b/source/format/count.ts @@ -1,4 +1,4 @@ -import { coalesceArray, mustExist } from "../data/nil.js"; +import { mustExist } from "../data/nil.js"; /** * Convert counts to a human readable string: `1234` → `1.234K`. @@ -27,10 +27,8 @@ export const parseCount = (count: string, locale?: string): number => { notation: "compact", }); const parts = format.formatToParts(-12345.6); - const orders = coalesceArray( - Array.from({ length: 20 }).map( - (_, i) => format.formatToParts(Math.pow(10, i)).find(d => d.type === "compact")?.value ?? "", - ), + const orders = Array.from({ length: 20 }).map( + (_, i) => format.formatToParts(Math.pow(10, i)).find(d => d.type === "compact")?.value ?? "", ); const numerals = Array.from({ length: 10 }).map((_, i) => format.format(i)); const index = new Map(numerals.map((d, i) => [d, i]));