index.js
function sorter (a, b) {
      const aDist = a.distance == null ? -1 : a.distance
      const bDist = b.distance == null ? -1 : b.distance
      if (aDist < bDist) {
        return 1
      }
      if (bDist < aDist) {
        return -1
      }
      return 0
    }
function sorter (a, b) {
      const aDist = a.distance == null ? -1 : a.distance
      const bDist = b.distance == null ? -1 : b.distance
      if (aDist < bDist) {
        return 1
      }
      if (bDist < aDist) {
        return -1
      }
      return 0
    }
function sorter ( a , b ) { const aDist = a . distance == null ? - 1 : a . distance const bDist = b . distance == null ? - 1 : b . distance if ( aDist < bDist ) { return 1 } if ( bDist < aDist ) { return - 1 } return 0 }
closer objects and objects with no distance come later in list
closer objects and objects with no distance come later in list