updated the test

This commit is contained in:
2026-08-27 13:40:48 +05:30
parent e34e41ca96
commit 8855b62b39
25 changed files with 9239 additions and 2 deletions

View File

@@ -18,18 +18,21 @@ const DECIMAL = new Intl.NumberFormat('en-IN');
/** Money, or a dash. `0` is a real amount and renders as ₹0.00. */
export const currency = (value, fallback = '—') => {
if (value === null || value === undefined || value === '') return fallback;
const n = Number(value);
return Number.isFinite(n) ? INR.format(n) : fallback;
};
/** A count with thousands separators, or a dash. */
export const number = (value, fallback = '—') => {
if (value === null || value === undefined || value === '') return fallback;
const n = Number(value);
return Number.isFinite(n) ? DECIMAL.format(n) : fallback;
};
/** A distance in km to one decimal, or a dash. */
export const km = (value, fallback = '—') => {
if (value === null || value === undefined || value === '') return fallback;
const n = Number(value);
return Number.isFinite(n) ? `${n.toFixed(1)} km` : fallback;
};