Source

number/getCurrencySymbol.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Get the currency symbol
 *
 * * This function require "Intl.NumberFormat" in global scope.
 * * Please see polyfill/polyfillIntl if you need a polyfill of that.
 * @category number
 * @module getCurrencySymbol
 */
var getCurrencySymbol = function (locales, currency) {
    if (locales === void 0) { locales = []; }
    if (currency === void 0) { currency = 'hkd'; }
    var formatter = new Intl.NumberFormat(locales, {
        style: 'currency',
        currency: currency.toUpperCase(),
    });
    var parts = formatter.formatToParts(0);
    var currencyPart = parts.find(function (part) { return part.type === 'currency'; });
    return currencyPart ? currencyPart.value : currency;
};
exports.default = getCurrencySymbol;