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

META-INF.resources.bower_components.globalize.dist.globalize-runtime.plural.js Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
/**
 * Globalize Runtime v1.2.3
 *
 * http://github.com/jquery/globalize
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2017-03-17T01:41Z
 */
/*!
 * Globalize Runtime v1.2.3 2017-03-17T01:41Z Released under the MIT license
 * http://git.io/TrdQbw
 */
(function (root, factory) {

    // UMD returnExports
    if (typeof define === "function" && define.amd) {

        // AMD
        define([
            "../globalize-runtime"
        ], factory);
    } else if (typeof exports === "object") {

        // Node, CommonJS
        module.exports = factory(require("../globalize-runtime"));
    } else {

        // Extend global
        factory(root.Globalize);
    }
}(this, function (Globalize) {

    var runtimeKey = Globalize._runtimeKey,
        validateParameterPresence = Globalize._validateParameterPresence,
        validateParameterType = Globalize._validateParameterType;


    var validateParameterTypeNumber = function (value, name) {
        validateParameterType(
            value,
            name,
            value === undefined || typeof value === "number",
            "Number"
        );
    };


    var pluralGeneratorFn = function (plural) {
        return function pluralGenerator(value) {
            validateParameterPresence(value, "value");
            validateParameterTypeNumber(value, "value");

            return plural(value);
        };
    };


    Globalize._pluralGeneratorFn = pluralGeneratorFn;
    Globalize._validateParameterTypeNumber = validateParameterTypeNumber;

    Globalize.plural =
        Globalize.prototype.plural = function (value, options) {
            validateParameterPresence(value, "value");
            validateParameterTypeNumber(value, "value");
            return this.pluralGenerator(options)(value);
        };

    Globalize.pluralGenerator =
        Globalize.prototype.pluralGenerator = function (options) {
            options = options || {};
            return Globalize[runtimeKey("pluralGenerator", this._locale, [options])];
        };

    return Globalize;


}));




© 2015 - 2024 Weber Informatics LLC | Privacy Policy