function formateaMoneda(valor, digits = 2, locale = 'es-ES', currency = 'EUR') { try { return new Intl.NumberFormat(locale, { style: 'currency', currency, minimumFractionDigits: digits, useGrouping: true }).format(valor); } catch { return valor; } } export { formateaMoneda }; function formateaNumero({ valor, digits = 2, style = 'decimal', locale = 'es-ES', currency = 'EUR' }) { const n = Number(valor); if (!Number.isFinite(n)) return valor; const opts = { useGrouping: true, minimumFractionDigits: digits, maximumFractionDigits: digits, }; if (style === 'currency') { opts.style = 'currency'; opts.currency = currency; } return new Intl.NumberFormat(locale, opts).format(n); } export { formateaNumero }; function isNumber(value) { return !isNaN(Number(value)) && value.trim() !== ''; } export { isNumber };