lib/simplifyExpression/collectAndCombineSearch/LikeTermCollector.js
// Sort function for termnames. Sort first by symbol name, and then by exponent.
Sort function for termnames. Sort first by symbol name, and then by exponent.
Sort function for termnames . Sort first by symbol name and then by exponent .
function sortTerms(a, b) {
  if (a === b) {
    return 0;
  }
  if (a.indexOf('^') === -1) {
    return a < b ? -1 : 1;
  }
  else {
    const symbA = a.split('^')[0];
    const expA = a.split('^')[1];
    const symbB = b.split('^')[0];
    const expB = b.split('^')[1];
    if (symbA !== symbB) {
      return symbA < symbB ? -1 : 1;
    }
    else {
      return expA > expB ? -1 : 1;
    }
  }
}
function sortTerms ( a , b ) { if ( a === b ) { return 0 ; } if ( a . indexOf ( '^' ) === - 1 ) { return a < b ? - 1 : 1 ; } else { const symbA = a . split ( '^' ) [ 0 ] ; const expA = a . split ( '^' ) [ 1 ] ; const symbB = b . split ( '^' ) [ 0 ] ; const expB = b . split ( '^' ) [ 1 ] ; if ( symbA !== symbB ) { return symbA < symbB ? - 1 : 1 ; } else { return expA > expB ? - 1 : 1 ; } } }
Sort function for termnames.
Sort function for termnames .
// if no exponent, sort alphabetically // if exponent: sort by symbol, but then exponent decreasing