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

META-INF.resources.bower_components.globalize.src.number.pattern-properties.min.js Maven / Gradle / Ivy

The newest version!
define(["./pattern-re","../common/create-error/unsupported-feature"],function(numberPatternRe,createErrorUnsupportedFeature){return function(pattern){var aux1,aux2,fractionPattern,integerFractionOrSignificantPattern,integerPattern,maximumFractionDigits,maximumSignificantDigits,minimumFractionDigits,minimumIntegerDigits,minimumSignificantDigits,padding,prefix,primaryGroupingSize,roundIncrement,scientificNotation,secondaryGroupingSize,significantPattern,suffix;pattern=pattern.match(numberPatternRe);if(!pattern){throw new Error("Invalid pattern: "+pattern)}prefix=pattern[1];padding=pattern[4];integerFractionOrSignificantPattern=pattern[5];significantPattern=pattern[9];scientificNotation=pattern[10];suffix=pattern[11];if(significantPattern){significantPattern.replace(/(@+)(#*)/,function(match,minimumSignificantDigitsMatch,maximumSignificantDigitsMatch){minimumSignificantDigits=minimumSignificantDigitsMatch.length;maximumSignificantDigits=minimumSignificantDigits+maximumSignificantDigitsMatch.length})}else{fractionPattern=pattern[8];integerPattern=pattern[7];if(fractionPattern){fractionPattern.replace(/[0-9]+/,function(match){minimumFractionDigits=match});if(minimumFractionDigits){roundIncrement=+("0."+minimumFractionDigits);minimumFractionDigits=minimumFractionDigits.length}else{minimumFractionDigits=0}maximumFractionDigits=fractionPattern.length-1}integerPattern.replace(/0+$/,function(match){minimumIntegerDigits=match.length})}if(scientificNotation){throw createErrorUnsupportedFeature({feature:"scientific notation (not implemented)"})}if(padding){throw createErrorUnsupportedFeature({feature:"padding (not implemented)"})}if((aux1=integerFractionOrSignificantPattern.lastIndexOf(","))!==-1){aux2=integerFractionOrSignificantPattern.split(".")[0];primaryGroupingSize=aux2.length-aux1-1;if((aux2=integerFractionOrSignificantPattern.lastIndexOf(",",aux1-1))!==-1){secondaryGroupingSize=aux1-1-aux2}}return[prefix,padding,minimumIntegerDigits,minimumFractionDigits,maximumFractionDigits,minimumSignificantDigits,maximumSignificantDigits,roundIncrement,primaryGroupingSize,secondaryGroupingSize,suffix]}});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy