Sha256: 5d3014e4f01ffbc6f6c18f9bdd92106953fb086c2ea065e852855d59509de792

Contents?: true

Size: 504 Bytes

Versions: 2

Compression:

Stored size: 504 Bytes

Contents

export function round (value) {
  return Math.round(value * 100) / 100
}

export function printCurrency (value, simboloMoneda = '$') {
  if (typeof value === 'string') {
    value = parseFloat(value)
  }
  const decimals = (value % 1 > 0) ? 2 : 0
  return simboloMoneda + ' ' + numberWithDots(value.toFixed(decimals).replace('.', ','))
}

export function showPercentage (value) {
  return '% ' + value
}

export function numberWithDots (x) {
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.')
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.13 pg_layout/app/javascript/utils.ts
pg_rails-7.0.8.pre.alpha.12 pg_layout/app/javascript/utils.ts