code: function (options) {                                                                         // 81
      var self = this;                                                                                          // 82
                                                                                                                // 83
      // If we have no distances, just use the comparator from the source                                       // 84
      // specification (which defaults to "everything is equal".                                                // 85
      if (!options || !options.distances) {                                                                     // 86
        return self._getBaseComparator();                                                                       // 87
      }                                                                                                         // 88
                                                                                                                // 89
      var distances = options.distances;                                                                        // 90
                                                                                                                // 91
      // Return a comparator which first tries the sort specification, and if that                              // 92
      // says "it's equal", breaks ties using $near distances.                                                  // 93
      return composeComparators([self._getBaseComparator(), function (a, b) {                                   // 94
        if (!distances.has(a._id))                                                                              // 95
          throw Error("Missing distance for " + a._id);                                                         // 96
        if (!distances.has(b._id))                                                                              // 97
          throw Error("Missing distance for " + b._id);                                                         // 98
        return distances.get(a._id) - distances.get(b._id);                                                     // 99
      }]);                                                                                                      // 100
    }
docs: 80