How to use the vtex.format-currency.formatCurrency function in vtex

To help you get started, we’ve selected a few vtex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex-apps / store-components / react / components / ProductPrice / Installments.js View on Github external
)

  /*
   * - The selected installment will be the one with the highest `NumberOfInstallments`;
   * - If there is no 'interest-free' installments, the normal installments will be analyzed.
   */
  const installment = (isEmpty(noInterestRateInstallments)
    ? installments
    : noInterestRateInstallments
  ).reduce((previous, current) =>
    previous.NumberOfInstallments > current.NumberOfInstallments
      ? previous
      : current
  )

  const formattedInstallmentPrice = formatCurrency({
    intl,
    culture,
    value: installment.Value,
  })

  const [installmentsElement, installmentPriceElement, timesElement] = [
    installment.NumberOfInstallments,
    formattedInstallmentPrice,
    <Fragment key="x">x</Fragment>,
  ].map((element, index) => (
    <span className={installmentClass} key={index}>
      {element}
    </span>
  ))

  return (