   (constants, display, messages, tooltips, $compile, $templateCache, $timeout, $document, $location) ->
     maybeInt = (s) ->
       if isNaN(i = parseInt(s, 10)) then s else i
+    byDefault = (a,b) -> +(a > b) || +(a == b) - 1
     byNumber = (a,b) -> a-b
     byId = (a,b) -> a.id-b.id
     byType = (a,b) ->

        sort = (values, compare) ->
          return unless values
          compare ?= byMagic
          order.sort (i, j) ->
            compare(values[i], values[j])
          return

        currentSort = undefined
        currentSortDirection = false
  
        # Sort by values, called name.

      if ta != tb
        a = ta
        b = tb
      byDefault(a,b)
    byMagic = (a,b) ->
      na = parseFloat(a)
      nb = parseFloat(b)
