/**
 * Comma number formatter
 * @param {Number} number Number to format
 * @param {String} [separator=','] Value used to separate numbers
 * @returns {String} Comma formatted number
 */
module.exports = function commaNumber (number, separator) {
  separator = typeof separator === 'undefined' ? ',' : ('' + separator)

  // Convert to number if it's a non-numeric value
  if (typeof number !== 'number') {
    number = Number(number)
  }

  // NaN => 0
  if (isNaN(number)) {
    number = 0
  }

  // Return Infinity immediately
  if (!isFinite(number)) {
    return '' + number
  }

  var stringNumber = ('' + Math.abs(number))
    .split('')
    .reverse()

  var result = []
  for (var i = 0; i < stringNumber.length; i++) {
    if (i && i % 3 === 0) {
      result.push(separator)
    }
    result.push(stringNumber[i])
  }

  // Handle negative numbers
  if (number < 0) {
    result.push('-')
  }

  return result
    .reverse()
    .join('')
}

/**
 * Comma number formatter
 * @param {Number} number Number to format
 * @param {String} [separator=','] Value used to separate numbers
 * @returns {String} Comma formatted number
 */
module.exports = function commaNumber (number, separator) {
  separator = typeof separator === 'undefined' ? ',' : ('' + separator)

  // Convert to number if it's a non-numeric value
  if (typeof number !== 'number')
    number = Number(number)

  // NaN => 0
  if (isNaN(number))
    number = 0

  // Return Infinity immediately
  if (!isFinite(number))
    return '' + number

  var stringNumber = ('' + Math.abs(number))
    .split('')
    .reverse()

  var result = []
  for (var i = 0; i < stringNumber.length; i++) {
    if (i && i % 3 === 0)
      result.push(separator)
    result.push(stringNumber[i])
  }

  // Handle negative numbers
  if (number < 0)
    result.push('-')

  return result
    .reverse()
    .join('')
}

--- 
+++ 
@@ -8,19 +8,16 @@
   separator = typeof separator === 'undefined' ? ',' : ('' + separator)
 
   // Convert to number if it's a non-numeric value
-  if (typeof number !== 'number') {
+  if (typeof number !== 'number')
     number = Number(number)
-  }
 
   // NaN => 0
-  if (isNaN(number)) {
+  if (isNaN(number))
     number = 0
-  }
 
   // Return Infinity immediately
-  if (!isFinite(number)) {
+  if (!isFinite(number))
     return '' + number
-  }
 
   var stringNumber = ('' + Math.abs(number))
     .split('')
@@ -28,16 +25,14 @@
 
   var result = []
   for (var i = 0; i < stringNumber.length; i++) {
-    if (i && i % 3 === 0) {
+    if (i && i % 3 === 0)
       result.push(separator)
-    }
     result.push(stringNumber[i])
   }
 
   // Handle negative numbers
-  if (number < 0) {
+  if (number < 0)
     result.push('-')
-  }
 
   return result
     .reverse()
Update code to follow standard style
