build: Replace jscs+jshint with eslint
[lhc/web/wiklou.git] / resources / src / mediawiki.language / mediawiki.language.numbers.js
index 268985f..1192650 100644 (file)
         * @return {string}
         */
        function replicate( str, num ) {
+               var buf = [];
+
                if ( num <= 0 || !str ) {
                        return '';
                }
 
-               var buf = [];
                while ( num-- ) {
                        buf.push( str );
                }
         * @return {string}
         */
        function pad( text, size, ch, end ) {
+               var out, padStr;
+
                if ( !ch ) {
                        ch = '0';
                }
 
-               var out = String( text ),
-                       padStr = replicate( ch, Math.ceil( ( size - out.length ) / ch.length ) );
+               out = String( text );
+               padStr = replicate( ch, Math.ceil( ( size - out.length ) / ch.length ) );
 
                return end ? out + padStr : padStr + out;
        }
         * @return {string}
         */
        function commafyNumber( value, pattern, options ) {
-               options = options || {
-                       group: ',',
-                       decimal: '.'
-               };
-
-               if ( isNaN( value ) ) {
-                       return value;
-               }
-
                var padLength,
                        patternDigits,
                        index,
                        groupSize2 = 0,
                        pieces = [];
 
+               options = options || {
+                       group: ',',
+                       decimal: '.'
+               };
+
+               if ( isNaN( value ) ) {
+                       return value;
+               }
+
                if ( patternParts[ 1 ] ) {
                        // Pad fractional with trailing zeros
                        padLength = ( patternParts[ 1 ] && patternParts[ 1 ].lastIndexOf( '0' ) + 1 );