function compareTableItem(sortKey, a, b) {
    var val1 = a[sortKey];
    var val2 = b[sortKey];

    // Compare the hosts of the origin ignoring schemes.
    if (sortKey == 'origin')
      return new URL(val1.url).host > new URL(val2.url).host ? 1 : -1;

    if (sortKey == 'baseScore' || sortKey == 'bonusScore' ||
        sortKey == 'totalScore') {
      return val1 - val2;
    }

    assertNotReached('Unsupported sort key: ' + sortKey);
    return 0;
  }
/**
   * Compares two SiteEngagementDetails objects based on |sortKey|.
   * @param {string} sortKey The name of the property to sort by.
   * @return {number} A negative number if |a| should be ordered before |b|, a
   * positive number otherwise.
   */
Compares two SiteEngagementDetails objects based on |sortKey|.
@param {string} sortKey The name of the property to sort by.
@return {number} A negative number if |a| should be ordered before |b|, a
positive number otherwise.
Compares two SiteEngagementDetails objects based on |sortKey| . @param { string } sortKey The name of the property to sort by . @return { number } A negative number if |a| should be ordered before |b| a positive number otherwise .
function compareTableItem(sortKey, a, b) {
    var val1 = a[sortKey];
    var val2 = b[sortKey];
    if (sortKey == 'origin')
      return new URL(val1.url).host > new URL(val2.url).host ? 1 : -1;
    if (sortKey == 'baseScore' || sortKey == 'bonusScore' ||
        sortKey == 'totalScore') {
      return val1 - val2;
    }
    assertNotReached('Unsupported sort key: ' + sortKey);
    return 0;
  }
function compareTableItem ( sortKey , a , b ) { var val1 = a [ sortKey ] ; var val2 = b [ sortKey ] ; if ( sortKey == 'origin' ) return new URL ( val1 . url ) . host > new URL ( val2 . url ) . host ? 1 : - 1 ; if ( sortKey == 'baseScore' || sortKey == 'bonusScore' || sortKey == 'totalScore' ) { return val1 - val2 ; } assertNotReached ( 'Unsupported sort key: ' + sortKey ) ; return 0 ; }
Compares two SiteEngagementDetails objects based on |sortKey|.
Compares two SiteEngagementDetails objects based on |sortKey| .
// Compare the hosts of the origin ignoring schemes.