UNPKG

@cranberry-money/shared-utils

Version:

Shared utility functions for Blueberry platform

15 lines 613 B
export const calculateTotalAllocation = (allocations) => { return allocations.reduce((total, allocation) => { return total + parseFloat(allocation.percentage || '0'); }, 0); }; export const validateAllocationPercentages = (allocations, tolerance = 0.01) => { const total = calculateTotalAllocation(allocations); return Math.abs(total - 100) <= tolerance; }; export const formatRiskLevelDisplay = (riskLevel) => { if (!riskLevel) return riskLevel; return riskLevel.charAt(0).toUpperCase() + riskLevel.slice(1).toLowerCase(); }; //# sourceMappingURL=portfolio-template.js.map