Skip to content

StorePilot/coinify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

npm i coinify -s

Usage

import coinify from 'coinify'

console.log(coinify.symbol('USD')) // Prints '$'

Functions


coinify.get(code)

Example

coinify.get('USD')

returns

{
  'symbol': '$',
  'name': 'US Dollar',
  'symbol_native': '$',
  'decimal_digits': 2,
  'rounding': 0,
  'code': 'USD',
  'name_plural': 'US dollars'
}

coinify.symbol(code, native = true)

Example

coinify.symbol('NOK')

returns

'kr'

&

coinify.symbol('NOK', false)

returns

'Nkr'

coinify.decimals(code)

Example

coinify.decimals('USD')

returns

2

coinify.rounding(code)

Example

coinify.rounding('USD')

returns

0

coinify.name(code, plural = false)

Example

coinify.name('USD')

returns

'US Dollar'

&

coinify.name('USD', true)

returns

'US dollars'

References:

https://en.wikipedia.org/wiki/ISO_4217 http://www.iotafinance.com/en/ISO-4217-Currency-Codes.html http://www.xe.com/symbols.php https://gist.github.com/Fluidbyte/2973986