Skip to content
Snippets Groups Projects
utils.ts 560 B
Newer Older
  • Learn to ignore specific revisions
  • Hugo NOUTS's avatar
    Hugo NOUTS committed
    import { FluidType } from '../enum/fluid.enum'
    
    
    export function getFluidType(type: string) {
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
      switch (type.toUpperCase()) {
        case 'ELECTRICITY':
          return FluidType.ELECTRICITY
        case 'WATER':
          return FluidType.WATER
        case 'GAS':
          return FluidType.GAS
        default:
          return FluidType.ELECTRICITY
      }
    }
    export function formatNumberValues(value: number) {
    
    Romain CREY's avatar
    Romain CREY committed
      if (value || value === 0) {
    
        return value.toLocaleString('fr-FR', {
          minimumFractionDigits: 2,
          maximumFractionDigits: 2,
        })
      } else {
        return '--,--'
      }
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    }