META-INF.resources.bower_components.globalize.src.unit.get.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
The newest version!
define(["./categories"],function(unitCategories){function stripPluralGarbage(data){var aux,pluralCount;if(data){aux={};for(pluralCount in data){aux[pluralCount.replace(/unitPattern-count-/,"")]=data[pluralCount]}}return aux}var get=function(unit,form,cldr){var ret;unit=unit.replace(/\//,"-per-");[""].concat(unitCategories).some(function(category){return ret=cldr.main(["units",form,category.length?category+"-"+unit:unit])});ret=stripPluralGarbage(ret);if(!ret&&/-per-/.test(unit)){unit=unit.split("-per-");ret=unit.map(function(unit){return get(unit,form,cldr)});if(!ret[0]||!ret[1]){return}}return ret};return get});