How to use currency-symbol-map - 10 common examples

To help you get started, we’ve selected a few currency-symbol-map 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 EdgeApp / edge-react-gui / src / modules / utils.js View on Github external
export const getFiatSymbol = (code: string) => {
  // console.log('inside utils.getFiatSymbol, code is: ', code)
  code = code.replace('iso:', '')
  return getSymbolFromCurrency(code)
}
github EdgeApp / edge-react-gui / src / modules / utils.js View on Github external
// @flow
import {Platform} from 'react-native'

import borderColors from '../theme/variables/css3Colors'
import {div, mul, gte, eq, toFixed} from 'biggystring'
import getSymbolFromCurrency from 'currency-symbol-map'
import type {AbcDenomination, AbcCurrencyInfo, AbcCurrencyPlugin, AbcTransaction, AbcMetaToken} from 'airbitz-core-types'
import type {GuiDenomination, ExchangeData, GuiWallet} from '../types'

const DIVIDE_PRECISION = 18

const currencySymbolMap = require('currency-symbol-map').currencySymbolMap

export const cutOffText = (str: string, lng: number) => {
  if (str.length >= lng) {
    return str.slice(0, lng) + '...'
  } else {
    return str
  }
}

export const findDenominationSymbol = (denoms: Array, value: string) => {
  // console.log('in findDenominationSymbol, denoms is: ', denoms, ' , and value is : ', value)
  for (const v of denoms) {
    if (v.name === value) {
      return v.symbol
    }
  }
github tmrowco / electricitymap-contrib / web / src / components / countryhistorypricesgraph.js View on Github external
const prepareGraphData = (historyData) => {
  if (!historyData || !historyData[0]) return {};

  const currencySymbol = getSymbolFromCurrency(((first(historyData) || {}).price || {}).currency);
  const valueAxisLabel = `${currencySymbol || '?'} / MWh`;

  const priceMaxValue = d3Max(historyData.map(d => (d.price || {}).value));
  const priceColorScale = scaleLinear()
    .domain([0, priceMaxValue])
    .range(['yellow', 'red']);

  const data = historyData.map(d => ({
    price: d.price && d.price.value,
    datetime: moment(d.stateDatetime).toDate(),
    // Keep a pointer to original data
    meta: d,
  }));

  const layerKeys = ['price'];
  const layerStroke = () => 'darkgray';
github interledger-deprecated / ilp-kit / api / src / lib / utils.js View on Github external
'use strict'

const _ = require('lodash')
const WebFinger = require('webfinger.js')
const currencySymbolMap = require('currency-symbol-map').currencySymbolMap
const superagent = require('superagent-promise')(require('superagent'), Promise)

const Config = require('./config')
const Ledger = require('./ledger')

const NotFoundError = require('../errors/not-found-error')

// TODO implement caching
module.exports = class Utils {
  static constitute () { return [ Config, Ledger ] }
  constructor (config, ledger) {
    this.ledger = ledger
    this.ledgerUriPublic = config.data.getIn(['ledger', 'public_uri'])
    this.ledgerPrefix = config.data.getIn(['ledger', 'prefix'])
    this.localUri = config.data.getIn(['server', 'base_uri'])
    this.localHost = config.data.getIn(['server', 'base_host'])
github EdgeApp / edge-react-gui / src / modules / utils.js View on Github external
export function getAllDenomsOfIsoCurrencies (): Array {
  // Convert map to an array
  const denomArray = []

  for (const currencyCode in currencySymbolMap) {
    if (currencySymbolMap.hasOwnProperty(currencyCode)) {
      const item = getDenomFromIsoCode(currencyCode)
      if (item.name.length) {
        denomArray.push(item)
      }
    }
  }
  return denomArray
}
github rwieruch / open-crowd-fund / src / components / Checkout.js View on Github external
}

    if (isError) {
      return (
        <div>
          <p>Something went wrong. The payment couldn't be processed.</p>
        </div>
      );
    }

    return (
      <div>
        <form>
          
            <label>
              Amount ({getSymbolFromCurrency(CONFIGURATION.currency)}):
            </label>

            <input required="" value="{amount}" max="99999" min="1" type="number">
          

          
            <label>Your Name (leave empty to stay anonymous):</label>

            </form></div>
github Annihil / revolut-emergency / src / components / Transaction.tsx View on Github external
{!state.match(/REVERTED|DECLINED|FAILED/) &amp;&amp; &lt;&gt;
          {merchant &amp;&amp; }
          {!merchant &amp;&amp; !isUser(recipient, sender) &amp;&amp; !cashbackBoxId &amp;&amp;
					}
          {isUser(recipient, sender) &amp;&amp; }
          {cashbackBoxId &amp;&amp; }
				}
        {state === 'PENDING' &amp;&amp; }
        {state === 'COMPLETED' &amp;&amp; type === 'TRANSFER' &amp;&amp; amount &gt; 0 &amp;&amp; }
        {state === 'COMPLETED' &amp;&amp; type === 'TRANSFER' &amp;&amp; amount &lt; 0 &amp;&amp; }
        {state === 'COMPLETED' &amp;&amp; type === 'TRANSFER' &amp;&amp; standingOrder &amp;&amp; }
      
      
        
          {merchant ? merchant.name : description}
          {sign(amount)}{getSymbolFromCurrency(currency)}{amountFmt(amount)}
        
        <spacer height=".25rem">
        
          <time>
            {moment(startedDate).format('MMM DD, HH:mm, YYYY')}
            {state === 'REVERTED' &amp;&amp; ', reverted'}
            {state.match(/DECLINED|FAILED/) &amp;&amp; ', declined'}
            {state === 'PENDING' &amp;&amp; ', pending'}
          </time>
          {counterpart &amp;&amp; counterpart.currency !== currency &amp;&amp;
					{sign(counterpart.amount)}{getSymbolFromCurrency(counterpart.currency)}{amountFmt(counterpart.amount)}}
        
      </spacer>
    
  ;
github service-bot / servicebot / views / components / elements / dashboard / dashboard-widgets.jsx View on Github external
getFormatted(value){
        if(this.props.type){
            if(this.props.type === 'price'){
                let {options} = this.props;
                let prefix = options.currency ? getSymbolFromCurrency(options.currency.value) : '';
                return 
            }
        }else{
            return value;
        }
    }
github rwieruch / open-crowd-fund / src / components / Currency.js View on Github external
const Currency = ({ currency = CONFIGURATION.currency }) =&gt; (
  <span>{getSymbolFromCurrency(currency)}</span>
);
github sogehige / sogeBot / src / bot / currency.ts View on Github external
public symbol(code: string) {
    return getSymbolFromCurrency(code);
  }

currency-symbol-map

A function to lookup the currency symbol for a given currency code

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis