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

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

The newest version!
(function(root,factory){if(typeof define==="function"&&define.amd){define(["../globalize-runtime"],factory)}else if(typeof exports==="object"){module.exports=factory(require("../globalize-runtime"))}else{factory(root.Globalize)}})(this,function(Globalize){var runtimeKey=Globalize._runtimeKey,validateParameterType=Globalize._validateParameterType;var isPlainObject=function(obj){return obj!==null&&""+obj==="[object Object]"};var validateParameterTypeMessageVariables=function(value,name){validateParameterType(value,name,value===undefined||isPlainObject(value)||Array.isArray(value),"Array or Plain Object")};var messageFormatterFn=function(formatter){return function messageFormatter(variables){if(typeof variables==="number"||typeof variables==="string"){variables=[].slice.call(arguments,0)}validateParameterTypeMessageVariables(variables,"variables");return formatter(variables)}};Globalize._messageFormatterFn=messageFormatterFn;Globalize._messageFormat=function(){var number=function(value,offset){if(isNaN(value))throw new Error("'"+value+"' isn't a number.");return value-(offset||0)};var plural=function(value,offset,lcfunc,data,isOrdinal){if({}.hasOwnProperty.call(data,value))return data[value]();if(offset)value-=offset;var key=lcfunc(value,isOrdinal);if(key in data)return data[key]();return data.other()};var select=function(value,data){if({}.hasOwnProperty.call(data,value))return data[value]();return data.other()};return{number:number,plural:plural,select:select}}();Globalize._validateParameterTypeMessageVariables=validateParameterTypeMessageVariables;Globalize.messageFormatter=Globalize.prototype.messageFormatter=function(){return Globalize[runtimeKey("messageFormatter",this._locale,[].slice.call(arguments,0))]};Globalize.formatMessage=Globalize.prototype.formatMessage=function(path){return this.messageFormatter(path).apply({},[].slice.call(arguments,1))};return Globalize});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy