How to use the currency-formatter.format function in currency-formatter

To help you get started, we’ve selected a few currency-formatter 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 opentripplanner / otp-react-redux / lib / components / narrative / line-itin / access-leg-body.js View on Github external
Wait until {formatTime(leg.startTime - tncData.estimatedArrival * 1000, timeOptions)} to book
                  
                
              
            )}
          

          {/* The estimated travel time */}
          <div>
            Estimated travel time: {formatDuration(leg.duration)} (does not account for traffic)
          </div>

          {/* The estimated travel cost */}
          {tncData.minCost &amp;&amp;
            <p>Estimated cost: {
              `${currencyFormatter.format(tncData.minCost, { code: tncData.currency })} - ${currencyFormatter.format(tncData.maxCost, { code: tncData.currency })}`
            }</p>
          }
        
      
    )
  }
}
github opentripplanner / otp-react-redux / lib / components / narrative / default / tnc-leg.js View on Github external
<a style="{{" href="{universalLinks[legMode.label.toUpperCase()]}">
          Book Ride
        </a>
        {tncData &amp;&amp; tncData.estimatedArrival
          ? <p>ETA for a driver: {formatDuration(tncData.estimatedArrival)}</p>
          : <p>Could not obtain eta estimate from {toSentenceCase(legMode.label)}!</p>
        }
        {/* tncData &amp;&amp; tncData.travelDuration &amp;&amp;
          <p>Estimated drive time: {formatDuration(tncData.travelDuration)}</p> */}
        {tncData &amp;&amp; tncData.minCost
          ? <p>Estimated cost: {
            `${currencyFormatter.format(tncData.minCost, { code: tncData.currency })} - ${currencyFormatter.format(tncData.maxCost, { code: tncData.currency })}`
          }</p>
          : <p>Could not obtain ride estimate from {toSentenceCase(legMode.label)}!</p>}
        }
      
    )
  }
}
github blockstack / blockstack-browser / app / js / wallet / components / CoreBalance.js View on Github external
usdBalance() {
    let btcPrice = this.props.btcPrice
    const btcBalance = this.props.coreWalletBalance

    btcPrice = Number(btcPrice)
    const usdBalance = btcPrice * btcBalance
    return currencyFormatter.format(usdBalance, { code: 'USD' })
  }
github ElementsProject / nanopos / src / util.js View on Github external
const fiatFormatter = currency => amount => Currency.format(amount, { code: currency.toUpperCase() })
github tohjustin / coincharts / src / containers / DocumentHead / index.js View on Github external
const DocumentHead = ({ selectedCryptocurrency, selectedCurrency, spotPrice }) =&gt; {
  const cryptocurrencySymbol = selectedCryptocurrency.toUpperCase();
  const iconPath = `${process.env.PUBLIC_URL}/icons/icon-${selectedCryptocurrency}.png`;
  const priceText = currencyFormatter.format(spotPrice, { code: selectedCurrency }) || "";

  return spotPrice &gt;= 0 ? (
    
      <title>{`${cryptocurrencySymbol}: ${priceText}`}</title>
      
    
  ) : (
    
      <title>{process.env.REACT_APP_NAME}</title>
      
    
  );
};
github ElementsProject / filebazaar / src / lib / util.js View on Github external
const fcurrency = p => p.currency === 'BTC' ? `${btc2milli(p.amount, true)} mBTC`
                       : CurrencyF.format(p.amount, { code: p.currency })
github trolster / urcli / src / commands / revenue.js View on Github external
output += `
    ${projectInfo}
    ${new Array(projectInfo.length + 1).join('-')}
        Total Assigned: ${totalAssigned}
            Reviewed: ${passed + failed}
            Ungradeable: ${ungradeable}
        Earned: ${currencyFormatter.format(earned, {code: 'USD'})}
        Average Turnaround Time: ${moment.utc(avgTurnaroundTime).format('HH:mm')}\n`;
  });


  const totalEarned = currencyFormatter.format(report.totalEarned, {code: 'USD'});
  output += `\nTotal Earned: ${totalEarned}\n`;

  if (report.numberOfDays > 1) {
    const dailyAverage = currencyFormatter.format(report.dailyAverage, {code: 'USD'});
    output += `Daily Average: ${dailyAverage}\n`;
  }
  output += '=============================================';
  return output;
}
github jozsi / mystash / src / isomorphic / currencyValue.js View on Github external
module.exports = (value, currency) => currencyFormatter.format(value, { code: currency });
github tohjustin / coincharts / src / components / TableMobile / PriceDetails.js View on Github external
const PriceDetails = ({ currency, priceDifference, percentDifference }) =&gt; {
  const formattedPriceDifference = currencyFormatter.format(Math.abs(priceDifference), { code: currency });
  const formattedPercentDifference = Math.abs(percentDifference).toFixed(2);

  if (priceDifference &gt; 0) {
    return (
      <div>
        
        {`${formattedPriceDifference} (${formattedPercentDifference}%)`}
      </div>
    );
  }

  return (
    <div>
      
      {`${formattedPriceDifference} (${formattedPercentDifference}%)`}
    </div>

currency-formatter

A simple Javascript utility that helps you to display currency properly

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis