client/locations-list-map.js
/**
 * Made by Mathias Bynens <http://mathiasbynens.be/>
 * Modified by Patrick Nelson to set useful param names and sane defaults for US_en locale.
 *
 * Example usage:
 *
 *    numberFormat(1000.15, 1, ',', '.');
 *
 * Result:  "1.000,2"
 */
Made by Mathias Bynens
Modified by Patrick Nelson to set useful param names and sane defaults for US_en locale.

Example usage.




Made by Mathias Bynens Modified by Patrick Nelson to set useful param names and sane defaults for US_en locale . Example usage .
function numberFormat(number, decimalPlaces, decSeparator, thouSeparator) {
  if (typeof decimalPlaces === 'undefined') {
    decimalPlaces = 0;
  }
  if (typeof decSeparator === 'undefined') {
    decSeparator = '.';
  }
  if (typeof thouSeparator === 'undefined') {
    thouSeparator = ',';
  }
  number = Math.round(number * (10 ** decimalPlaces)) / (10 ** decimalPlaces);
  const e = String(number);
  const f = e.split('.');
  if (!f[0]) {
    f[0] = '0';
  }
  if (!f[1]) {
    f[1] = '';
  }
  if (f[1].length < decimalPlaces) {
    let g = f[1];
    for (let i = f[1].length + 1; i <= decimalPlaces; i++) {
      g += '0';
    }
    f[1] = g;
  }
  if (thouSeparator !== '' && f[0].length > 3) {
    const h = f[0];
    f[0] = '';
    for (let j = 3; j < h.length; j += 3) {
      const i = h.slice(h.length - j, h.length - j + 3);
      f[0] = String(thouSeparator + i + f[0]);
    }
    const j = h.substr(0, (h.length % 3 === 0) ? 3 : (h.length % 3));
    f[0] = j + f[0];
  }
  decSeparator = (decimalPlaces <= 0) ? '' : decSeparator;
  return f[0] + decSeparator + f[1];
}
function numberFormat ( number , decimalPlaces , decSeparator , thouSeparator ) { if ( typeof decimalPlaces === 'undefined' ) { decimalPlaces = 0 ; } if ( typeof decSeparator === 'undefined' ) { decSeparator = '.' ; } if ( typeof thouSeparator === 'undefined' ) { thouSeparator = ',' ; } number = Math . round ( number * ( 10 ** decimalPlaces ) ) / ( 10 ** decimalPlaces ) ; const e = String ( number ) ; const f = e . split ( '.' ) ; if ( ! f [ 0 ] ) { f [ 0 ] = '0' ; } if ( ! f [ 1 ] ) { f [ 1 ] = '' ; } if ( f [ 1 ] . length < decimalPlaces ) { let g = f [ 1 ] ; for ( let i = f [ 1 ] . length + 1 ; i <= decimalPlaces ; i ++ ) { g += '0' ; } f [ 1 ] = g ; } if ( thouSeparator !== '' && f [ 0 ] . length > 3 ) { const h = f [ 0 ] ; f [ 0 ] = '' ; for ( let j = 3 ; j < h . length ; j += 3 ) { const i = h . slice ( h . length - j , h . length - j + 3 ) ; f [ 0 ] = String ( thouSeparator + i + f [ 0 ] ) ; } const j = h . substr ( 0 , ( h . length % 3 === 0 ) ? 3 : ( h . length % 3 ) ) ; f [ 0 ] = j + f [ 0 ] ; } decSeparator = ( decimalPlaces <= 0 ) ? '' : decSeparator ; return f [ 0 ] + decSeparator + f [ 1 ] ; }
Made by Mathias Bynens <http://mathiasbynens.be/>
 Modified by Patrick Nelson to set useful param names and sane defaults for US_en locale.
Made by Mathias Bynens <http : // mathiasbynens . be / > Modified by Patrick Nelson to set useful param names and sane defaults for US_en locale .
// Init defaults.