@@ -11,11 +11,14 @@ const DECIMAL_SEPARATOR = ".";
1111const patternRegExp = / ( [ # , 0 . ] + ) / g;
1212const cldrCurrencyRegExp = / ¤ / g;
1313
14- function patternOptions ( pattern ) {
15- const patterns = pattern
16- . replace ( cldrCurrencyRegExp , "$" )
17- . replace ( patternRegExp , "n" )
18- . split ( ";" ) ;
14+ function getPatterns ( pattern ) {
15+ patternRegExp . lastIndex = 0 ;
16+
17+ return pattern . replace ( cldrCurrencyRegExp , "$" ) . replace ( patternRegExp , "n" ) . split ( ";" ) ;
18+ }
19+
20+ function getGroupSize ( pattern ) {
21+ patternRegExp . lastIndex = 0 ;
1922
2023 const numberPatterns = patternRegExp . exec ( pattern . split ( LIST_SEPARATOR ) [ 0 ] ) [ 0 ] . split ( DECIMAL_SEPARATOR ) ;
2124 const integer = numberPatterns [ 0 ] ;
@@ -24,10 +27,7 @@ function patternOptions(pattern) {
2427 return group . length ;
2528 } ) . reverse ( ) ;
2629
27- return {
28- groupSize : groupSize ,
29- patterns : patterns
30- } ;
30+ return groupSize ;
3131}
3232
3333function loadCurrencyUnitPatterns ( currencyInfo , currencyFormats ) {
@@ -48,9 +48,14 @@ export default function loadNumbersInfo(locale, info) {
4848 } else if ( field . includes ( LATIN_NUMBER_FORMATS ) ) {
4949 const style = field . substr ( 0 , field . indexOf ( LATIN_NUMBER_FORMATS ) ) ;
5050 const pattern = info [ field ] . standard ;
51- numbers [ style ] = patternOptions ( pattern ) ;
51+ numbers [ style ] = {
52+ patterns : getPatterns ( pattern )
53+ } ;
5254 if ( style === "currency" ) {
55+ numbers [ style ] . groupSize = getGroupSize ( ( info [ "decimal" + LATIN_NUMBER_FORMATS ] || info [ field ] ) . standard ) ;
5356 loadCurrencyUnitPatterns ( numbers [ style ] , info [ field ] ) ;
57+ } else {
58+ numbers [ style ] . groupSize = getGroupSize ( pattern ) ;
5459 }
5560 } else if ( field === "currencies" ) {
5661 numbers . currencies = info [ field ] ;
0 commit comments