[
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules\njspm_packages\n\n# Optional npm cache directory\n.npm\n\n# Optional REPL history\n.node_repl_history\n"
  },
  {
    "path": "LICENSE.md",
    "content": "Copyright (c) 2017, Ben Gourley\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright notice,\n      this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright notice,\n      this list of conditions and the following disclaimer in the documentation\n      and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER\nOR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "Readme.md",
    "content": "# currency-symbol-map\n\nA function to lookup the currency symbol for a given currency code.\n\n## Installation\n\n    npm install currency-symbol-map\n\n## Usage\n\n### Get symbol from currency code\n```js\n// ES5\nconst getSymbolFromCurrency = require('currency-symbol-map')\n\n// ES6\nimport getSymbolFromCurrency from 'currency-symbol-map'\n\ngetSymbolFromCurrency('GBP') //=> '£'\ngetSymbolFromCurrency('EUR') //=> '€'\ngetSymbolFromCurrency('USD') //=> '$'\ngetSymbolFromCurrency('NOT A VALID CODE') //=> undefined\n```\n\n### Exposed map for other processing\n```js\n// ES5\nconst currencyToSymbolMap = require('currency-symbol-map/map')\n\n// ES6\nimport currencyToSymbolMap from 'currency-symbol-map/map'\n\nconsole.log(currencyToSymbolMap)\n// =>\n{\n \"USD\": \"$\",\n \"GBP\": \"£\",\n …\n}\n```\n\n## Tests\n```bash\nnpm test\n```\n\n## Changelog\n\n### 5.1.0\n- Add CNH Currency mapping: [#82](https://github.com/bengourley/currency-symbol-map/pull/82)\n\n### 5.0.1\n- upgraded linter and improved code formatting ([#63](https://github.com/bengourley/currency-symbol-map/pull/63))\n\n### 5.0.0\n- added some missing currencies ([#61](https://github.com/bengourley/currency-symbol-map/pull/61))\n- fixed the BTC symbol ([#50](https://github.com/bengourley/currency-symbol-map/pull/50))\n- fixed the KZT symbol ([#52](https://github.com/bengourley/currency-symbol-map/pull/52))\n- fixed the SGD symbol ([#55](https://github.com/bengourley/currency-symbol-map/pull/55))\n- added TypeScript typings ([#53](https://github.com/bengourley/currency-symbol-map/pull/53))\n- upgraded test libraries & added extra test cases ([#62](https://github.com/bengourley/currency-symbol-map/pull/62))\n\n### 4.0.0\n- the reverse lookup feature was removed (retrieving currency given a symbol) because\nthere is not a deterministic way to do so (i.e. the same symbol is used by multiple currencies).\n- in previous versions, an unsuccessful lookup would return the `'?'` character. It now returns\n`undefined` so that it is up to you how to handle the failure.\n\n## Credits\n\nCurrency symbols originally sourced from [xe](http://www.xe.com/symbols.php), but maintained\nand updated by [contributors](https://github.com/bengourley/currency-symbol-map/pulls?q=is%3Apr+is%3Aclosed).\n"
  },
  {
    "path": "currency-symbol-map.d.ts",
    "content": "declare function getSymbolFromCurrency (currencyCode: string): string | undefined\nexport = getSymbolFromCurrency\n"
  },
  {
    "path": "currency-symbol-map.js",
    "content": "const currencySymbolMap = require('./map')\n\nmodule.exports = function getSymbolFromCurrency (currencyCode) {\n  if (typeof currencyCode !== 'string') {\n    return undefined\n  }\n\n  const code = currencyCode.toUpperCase()\n\n  if (!Object.prototype.hasOwnProperty.call(currencySymbolMap, code)) {\n    return undefined\n  }\n\n  return currencySymbolMap[code]\n}\n\nmodule.exports.currencySymbolMap = currencySymbolMap\n"
  },
  {
    "path": "map.js",
    "content": "module.exports = {\n  AED: 'د.إ',\n  AFN: '؋',\n  ALL: 'L',\n  AMD: '֏',\n  ANG: 'ƒ',\n  AOA: 'Kz',\n  ARS: '$',\n  AUD: '$',\n  AWG: 'ƒ',\n  AZN: '₼',\n  BAM: 'KM',\n  BBD: '$',\n  BDT: '৳',\n  BGN: 'лв',\n  BHD: '.د.ب',\n  BIF: 'FBu',\n  BMD: '$',\n  BND: '$',\n  BOB: '$b',\n  BOV: 'BOV',\n  BRL: 'R$',\n  BSD: '$',\n  BTC: '₿',\n  BTN: 'Nu.',\n  BWP: 'P',\n  BYN: 'Br',\n  BYR: 'Br',\n  BZD: 'BZ$',\n  CAD: '$',\n  CDF: 'FC',\n  CHE: 'CHE',\n  CHF: 'CHF',\n  CHW: 'CHW',\n  CLF: 'CLF',\n  CLP: '$',\n  CNH: '¥',\n  CNY: '¥',\n  COP: '$',\n  COU: 'COU',\n  CRC: '₡',\n  CUC: '$',\n  CUP: '₱',\n  CVE: '$',\n  CZK: 'Kč',\n  DJF: 'Fdj',\n  DKK: 'kr',\n  DOP: 'RD$',\n  DZD: 'دج',\n  EEK: 'kr',\n  EGP: '£',\n  ERN: 'Nfk',\n  ETB: 'Br',\n  ETH: 'Ξ',\n  EUR: '€',\n  FJD: '$',\n  FKP: '£',\n  GBP: '£',\n  GEL: '₾',\n  GGP: '£',\n  GHC: '₵',\n  GHS: 'GH₵',\n  GIP: '£',\n  GMD: 'D',\n  GNF: 'FG',\n  GTQ: 'Q',\n  GYD: '$',\n  HKD: '$',\n  HNL: 'L',\n  HRK: 'kn',\n  HTG: 'G',\n  HUF: 'Ft',\n  IDR: 'Rp',\n  ILS: '₪',\n  IMP: '£',\n  INR: '₹',\n  IQD: 'ع.د',\n  IRR: '﷼',\n  ISK: 'kr',\n  JEP: '£',\n  JMD: 'J$',\n  JOD: 'JD',\n  JPY: '¥',\n  KES: 'KSh',\n  KGS: 'лв',\n  KHR: '៛',\n  KMF: 'CF',\n  KPW: '₩',\n  KRW: '₩',\n  KWD: 'KD',\n  KYD: '$',\n  KZT: '₸',\n  LAK: '₭',\n  LBP: '£',\n  LKR: '₨',\n  LRD: '$',\n  LSL: 'M',\n  LTC: 'Ł',\n  LTL: 'Lt',\n  LVL: 'Ls',\n  LYD: 'LD',\n  MAD: 'MAD',\n  MDL: 'lei',\n  MGA: 'Ar',\n  MKD: 'ден',\n  MMK: 'K',\n  MNT: '₮',\n  MOP: 'MOP$',\n  MRO: 'UM',\n  MRU: 'UM',\n  MUR: '₨',\n  MVR: 'Rf',\n  MWK: 'MK',\n  MXN: '$',\n  MXV: 'MXV',\n  MYR: 'RM',\n  MZN: 'MT',\n  NAD: '$',\n  NGN: '₦',\n  NIO: 'C$',\n  NOK: 'kr',\n  NPR: '₨',\n  NZD: '$',\n  OMR: '﷼',\n  PAB: 'B/.',\n  PEN: 'S/.',\n  PGK: 'K',\n  PHP: '₱',\n  PKR: '₨',\n  PLN: 'zł',\n  PYG: 'Gs',\n  QAR: '﷼',\n  RMB: '￥',\n  RON: 'lei',\n  RSD: 'Дин.',\n  RUB: '₽',\n  RWF: 'R₣',\n  SAR: '﷼',\n  SBD: '$',\n  SCR: '₨',\n  SDG: 'ج.س.',\n  SEK: 'kr',\n  SGD: 'S$',\n  SHP: '£',\n  SLL: 'Le',\n  SOS: 'S',\n  SRD: '$',\n  SSP: '£',\n  STD: 'Db',\n  STN: 'Db',\n  SVC: '$',\n  SYP: '£',\n  SZL: 'E',\n  THB: '฿',\n  TJS: 'SM',\n  TMT: 'T',\n  TND: 'د.ت',\n  TOP: 'T$',\n  TRL: '₤',\n  TRY: '₺',\n  TTD: 'TT$',\n  TVD: '$',\n  TWD: 'NT$',\n  TZS: 'TSh',\n  UAH: '₴',\n  UGX: 'USh',\n  USD: '$',\n  UYI: 'UYI',\n  UYU: '$U',\n  UYW: 'UYW',\n  UZS: 'лв',\n  VEF: 'Bs',\n  VES: 'Bs.S',\n  VND: '₫',\n  VUV: 'VT',\n  WST: 'WS$',\n  XAF: 'FCFA',\n  XBT: 'Ƀ',\n  XCD: '$',\n  XOF: 'CFA',\n  XPF: '₣',\n  XSU: 'Sucre',\n  XUA: 'XUA',\n  YER: '﷼',\n  ZAR: 'R',\n  ZMW: 'ZK',\n  ZWD: 'Z$',\n  ZWL: '$'\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"currency-symbol-map\",\n  \"version\": \"5.1.0\",\n  \"description\": \"A function to lookup the currency symbol for a given currency code\",\n  \"main\": \"currency-symbol-map.js\",\n  \"scripts\": {\n    \"test\": \"standard && tape test.js | tap-spec\"\n  },\n  \"publishConfig\": {\n    \"registry\": \"https://registry.npmjs.org/\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git@github.com:bengourley/currency-symbol-map.git\"\n  },\n  \"keywords\": [\n    \"currency\",\n    \"symbol\"\n  ],\n  \"author\": \"Ben Gourley\",\n  \"license\": \"BSD-2-Clause\",\n  \"bugs\": {\n    \"url\": \"https://github.com/bengourley/currency-symbol-map/issues\"\n  },\n  \"devDependencies\": {\n    \"standard\": \"^16.0.3\",\n    \"tap-spec\": \"^5.0.0\",\n    \"tape\": \"^5.1.1\"\n  }\n}\n"
  },
  {
    "path": "test.js",
    "content": "const test = require('tape')\n\nconst getSymbolFromCurrency = require('./')\nconst currencySymbolMap = require('./map')\n\ntest('getSymbolFromCurrency(): valid params', t => {\n  t.equal('$', getSymbolFromCurrency('USD'), 'should return $ when USD is provided')\n  t.equal('£', getSymbolFromCurrency('GBP'), 'should return £ when GBP is provided')\n  t.equal('€', getSymbolFromCurrency('EUR'), 'should return € when EUR is provided')\n  t.equal('€', getSymbolFromCurrency('eur'), 'should return € when eur is provided')\n  t.equal(undefined, getSymbolFromCurrency('NON-EXISTENT-CODE'), 'should return undefined when code is non-existent')\n  t.end()\n})\n\ntest('getSymbolFromCurrency(): invalid params', t => {\n  t.equal(undefined, getSymbolFromCurrency(1), 'should return undefined when param is not a string')\n  t.equal(undefined, getSymbolFromCurrency(null), 'should return undefined when param is null')\n  t.equal(undefined, getSymbolFromCurrency(false), 'should return undefined when param is false')\n  t.equal(undefined, getSymbolFromCurrency(), 'should return undefined when param is undefined')\n  t.end()\n})\n\ntest('currency-symbol-map: sanity check every value in map', t => {\n  const currencies = Object.keys(currencySymbolMap)\n  const obj = {}\n  currencies.forEach(code => { obj[code] = getSymbolFromCurrency(code) })\n  t.deepEqual(obj, currencySymbolMap)\n  t.end()\n})\n\ntest('currency-symbol-map: no symbols should be missing', t => {\n  for (const code in currencySymbolMap) {\n    t.equal(typeof currencySymbolMap[code], 'string', `Symbol of ${code} should be a string`)\n    t.isNotEqual(currencySymbolMap[code], '', `Symbol of ${code} should not be empty`)\n  }\n  t.end()\n})\n\ntest('currency-symbol-map: codes should be in alphabetical order', t => {\n  const currencies = Object.keys(currencySymbolMap)\n  const sorted = Object.keys(currencySymbolMap).sort((a, b) => a.localeCompare(b))\n  t.deepEqual(currencies, sorted)\n  t.end()\n})\n"
  }
]