How to use the currency-symbol-map.currencySymbolMap function in currency-symbol-map

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
// @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 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 interledger-deprecated / ilp-kit / api / src / controllers / misc.js View on Github external
'use strict'

module.exports = MiscControllerFactory

const Config = require('../lib/config')
const Ledger = require('../lib/ledger')
const Utils = require('../lib/utils')
const currencySymbolMap = require('currency-symbol-map').currencySymbolMap
const Connector = require('../lib/connector')
const InvalidBodyError = require('../errors/invalid-body-error')

function MiscControllerFactory (deps) {
  const config = deps(Config)
  const ledger = deps(Ledger)
  const utils = deps(Utils)
  const connector = deps(Connector)

  return class MiscController {
    static init (router) {
      router.get('/parse/destination', this.destination)
      router.get('/config', this.config)
    }

    /**

currency-symbol-map

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

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis