src/similarweb.js
/**
 * Calculate each rank element's number based on numberString and element's percentage
 * @param {string} numberString number string
 * @param {array} rank Array of objects that contain rank info
 */
Calculate each rank element's number based on numberString and element's percentage
@param {string} numberString number string
@param {array} rank Array of objects that contain rank info
Calculate each rank element ' s number based on numberString and element ' s percentage @param { string } numberString number string @param { array } rank Array of objects that contain rank info
function calculateNumberInRank(numberString, rank) {
  let number = getNum(numberString);
  for (let i=0; i<rank.length; i++) {
    rank[i].number = (number * getPercentage(rank[i].percentage)).toFixed(2);
    if (isNaN(rank[i].number)) {
      console.log('!!! Some rank number is NaN !!!');
      console.log(number);
      console.log(getPercentage(rank[i].percentage));
    }
  }
}
function calculateNumberInRank ( numberString , rank ) { let number = getNum ( numberString ) ; for ( let i = 0 ; i < rank . length ; i ++ ) { rank [ i ] . number = ( number * getPercentage ( rank [ i ] . percentage ) ) . toFixed ( 2 ) ; if ( isNaN ( rank [ i ] . number ) ) { console . log ( '!!! Some rank number is NaN !!!' ) ; console . log ( number ) ; console . log ( getPercentage ( rank [ i ] . percentage ) ) ; } } }
Calculate each rank element's number based on numberString and element's percentage
 @param {string} numberString number string
 @param {array} rank Array of objects that contain rank info
Calculate each rank element ' s number based on numberString and element ' s percentage @param { string } numberString number string @param { array } rank Array of objects that contain rank info