All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.globalize.src.currency.supplemental-override.js Maven / Gradle / Ivy

The newest version!
define([
    "../util/string/pad"
], function (stringPad) {

    /**
     * supplementalOverride( currency, pattern, cldr )
     *
     * Return pattern with fraction digits overriden by supplemental currency data.
     */
    return function (currency, pattern, cldr) {
        var digits,
            fraction = "",
            fractionData = cldr.supplemental(["currencyData/fractions", currency]) ||
                cldr.supplemental("currencyData/fractions/DEFAULT");

        digits = +fractionData._digits;

        if (digits) {
            fraction = "." + stringPad("0", digits).slice(0, -1) + fractionData._rounding;
        }

        return pattern.replace(/\.(#+|0*[0-9]|0+[0-9]?)/g, fraction);
    };

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy