All files / app/src/features/measure/lib display-price-values.ts

8.33% Statements 1/12
100% Branches 0/0
0% Functions 0/1
8.33% Lines 1/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    1x                        
import { TFunction } from '@/shared/@types'
 
export const displayPriceValues = (t: TFunction, values?: string[]) => {
  if (!values) return null
  const isAllNull = values?.every(item => item === null || item === '') || !values?.length
  if (isAllNull) return null
  if (!values?.[1]) {
    return t('common:from') + ' ' + values?.[0]
  }
  if (values?.length === 2 && !values?.[0]) {
    return t('common:to') + ' ' + values?.[1]
  }
  return `${values?.[0]} - ${values?.[1]}`
}