code: function rangeCollapse(paths) {
      paths.forEach(function (path) {
          path.forEach(function (elt, index) {
              var range;
              if (Array.isArray(elt) && elt.every(isNumber) && allUnique(elt)) {
                  elt.sort(function(a, b) {
                      return a - b;
                  });
                  if (elt[elt.length-1] - elt[0] === elt.length-1) {
                      // create range
                      range = {};
                      range.from = elt[0];
                      range.to = elt[elt.length-1];
                      path[index] = range;
                  }
              }
          });
      });
      return paths;
  }
docs: Collapse ranges, e.g. when there is a continuous range
  in an array, turn it into an object instead
  
  [1,2,3,4,5,6] => {"from":1, "to":6}