src/aria/utils/Number.js
function (integer, patternDescription, formatSymbols) {
            if (!patternDescription.hasGrouping) {
                // No grouping is used in the pattern, no need to do anything
                return integer;
            }

            var grouping = formatSymbols.groupingSeparator, pattern = patternDescription.integer, repeat = patternDescription.regularGroup;
            var lengths = [];

            if (repeat > 0) {
                lengths = repeat;
            } else {
                // The pattern is not regular, build the array for chunk
                var tokens = pattern.split(",");
                for (var i = tokens.length - 1; i > 0; i -= 1) {
                    // The last token shouldn't be considered because it should contain the remainings
                    lengths.push(tokens[i].length);
                }
            }

            return ariaUtilsString.chunk(integer, lengths).join(grouping);
        }
function (integer, patternDescription, formatSymbols) {
            if (!patternDescription.hasGrouping) {
                // No grouping is used in the pattern, no need to do anything
                return integer;
            }

            var grouping = formatSymbols.groupingSeparator, pattern = patternDescription.integer, repeat = patternDescription.regularGroup;
            var lengths = [];

            if (repeat > 0) {
                lengths = repeat;
            } else {
                // The pattern is not regular, build the array for chunk
                var tokens = pattern.split(",");
                for (var i = tokens.length - 1; i > 0; i -= 1) {
                    // The last token shouldn't be considered because it should contain the remainings
                    lengths.push(tokens[i].length);
                }
            }

            return ariaUtilsString.chunk(integer, lengths).join(grouping);
        }
function ( integer , patternDescription , formatSymbols ) { if ( ! patternDescription . hasGrouping ) { // No grouping is used in the pattern, no need to do anything return integer ; } var grouping = formatSymbols . groupingSeparator , pattern = patternDescription . integer , repeat = patternDescription . regularGroup ; var lengths = [ ] ; if ( repeat > 0 ) { lengths = repeat ; } else { // The pattern is not regular, build the array for chunk var tokens = pattern . split ( "," ) ; for ( var i = tokens . length - 1 ; i > 0 ; i -= 1 ) { // The last token shouldn't be considered because it should contain the remainings lengths . push ( tokens [ i ] . length ) ; } } return ariaUtilsString . chunk ( integer , lengths ) . join ( grouping ) ; }
Add the grouping symbol to the integer part of a number by following the desired pattern.
@private
@param {String} integer Integer part of the number
@param {Object} patternDescription description of the pattern as returned by this._explode
@param {Object} formatSymbols normalized formatting symbols as returned by this._normalizeSymbols
@return {String} Integer part of the number containing grouping separator
Add the grouping symbol to the integer part of a number by following the desired pattern .