lib/third_party/tracing/extras/rail/rail_interaction_record.js
function railCompare(name1, name2) {
    var i1 = RAIL_ORDER.indexOf(name1.toUpperCase());
    var i2 = RAIL_ORDER.indexOf(name2.toUpperCase());
    if (i1 == -1 && i2 == -1)
      return name1.localeCompare(name2);
    if (i1 == -1)
      return 1;   // i2 is a RAIL name but not i1.
    if (i2 == -1)
      return -1;  // i1 is a RAIL name but not i2.
    // Two rail names.
    return i1 - i2;
  }
function railCompare(name1, name2) {
    var i1 = RAIL_ORDER.indexOf(name1.toUpperCase());
    var i2 = RAIL_ORDER.indexOf(name2.toUpperCase());
    if (i1 == -1 && i2 == -1)
      return name1.localeCompare(name2);
    if (i1 == -1)
      return 1;   // i2 is a RAIL name but not i1.
    if (i2 == -1)
      return -1;  // i1 is a RAIL name but not i2.
    // Two rail names.
    return i1 - i2;
  }
function railCompare ( name1 , name2 ) { var i1 = RAIL_ORDER . indexOf ( name1 . toUpperCase ( ) ) ; var i2 = RAIL_ORDER . indexOf ( name2 . toUpperCase ( ) ) ; if ( i1 == - 1 && i2 == - 1 ) return name1 . localeCompare ( name2 ) ; if ( i1 == - 1 ) return 1 ; // i2 is a RAIL name but not i1. if ( i2 == - 1 ) return - 1 ; // i1 is a RAIL name but not i2. // Two rail names. return i1 - i2 ; }
Compare two rail type names or rail user-friendly names so they are sorted in R,A,I,L order. Capitalization is ignore. Non rail names are sorted lexicographically after rail names.
Compare two rail type names or rail user - friendly names so they are sorted in R A I L order . Capitalization is ignore . Non rail names are sorted lexicographically after rail names .