META-INF.resources.bower_components.globalize.src.currency.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
define(["./core","./common/runtime-bind","./common/validate/cldr","./common/validate/default-locale","./common/validate/parameter-presence","./common/validate/parameter-type/currency","./common/validate/parameter-type/number","./common/validate/parameter-type/plain-object","./currency/code-properties","./currency/formatter-fn","./currency/name-properties","./currency/symbol-properties","./util/object/omit","./number","cldr/event","cldr/supplemental"],function(Globalize,runtimeBind,validateCldr,validateDefaultLocale,validateParameterPresence,validateParameterTypeCurrency,validateParameterTypeNumber,validateParameterTypePlainObject,currencyCodeProperties,currencyFormatterFn,currencyNameProperties,currencySymbolProperties,objectOmit){function validateRequiredCldr(path,value){validateCldr(path,value,{skip:[/supplemental\/currencyData\/fractions\/[A-Za-z]{3}$/]})}Globalize.currencyFormatter=Globalize.prototype.currencyFormatter=function(currency,options){var args,cldr,numberFormatter,pluralGenerator,properties,returnFn,style;validateParameterPresence(currency,"currency");validateParameterTypeCurrency(currency,"currency");validateParameterTypePlainObject(options,"options");cldr=this.cldr;options=options||{};args=[currency,options];style=options.style||"symbol";validateDefaultLocale(cldr);cldr.on("get",validateRequiredCldr);properties={accounting:currencySymbolProperties,code:currencyCodeProperties,name:currencyNameProperties,symbol:currencySymbolProperties}[style](currency,cldr,options);cldr.off("get",validateRequiredCldr);options=objectOmit(options,"style");options.raw=properties.pattern;if(style==="symbol"||style==="accounting"){numberFormatter=this.numberFormatter(options);returnFn=currencyFormatterFn(numberFormatter);runtimeBind(args,cldr,returnFn,[numberFormatter])}else{numberFormatter=this.numberFormatter(options);pluralGenerator=this.pluralGenerator();returnFn=currencyFormatterFn(numberFormatter,pluralGenerator,properties);runtimeBind(args,cldr,returnFn,[numberFormatter,pluralGenerator,properties])}return returnFn};Globalize.currencyParser=Globalize.prototype.currencyParser=function(){};Globalize.formatCurrency=Globalize.prototype.formatCurrency=function(value,currency,options){validateParameterPresence(value,"value");validateParameterTypeNumber(value,"value");return this.currencyFormatter(currency,options)(value)};Globalize.parseCurrency=Globalize.prototype.parseCurrency=function(){};return Globalize});