Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                         $scope.reportComparisons
  2.                         .sort((a, b) => {
  3.                             let result;
  4.  
  5.                             if (!a.isValid) {
  6.                                 result = isAscending ? 1 : -1;
  7.                             } else if (!b.isValid) {
  8.                                 result = isAscending ? -1 : 1;
  9.                             } else {
  10.                                 const aAppName = a.appName.toLowerCase();
  11.                                 const bAppName = b.appName.toLowerCase();
  12.  
  13.                                 result = aAppName < bAppName ? 1 : -1;
  14.  
  15.                                 if (isAscending) {
  16.                                     result *= -1;
  17.                                 }
  18.                             }
  19.  
  20.                             return result;
  21.                         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement