code: function findNodeBeforePos(pos) {
      const lut = this.ends;
      assert(is.finitenumber(pos) && pos >= 0);
  
      let left = 0;
      let right = lut.length - 1;
      while (left < right) {
          const mid = Math.ceil((left + right) / 2);
          assert(mid >= 0 && mid < lut.length);
          if (pos < lut[mid].range[1]) {
              right = mid - 1;
          }
          else {
              left = mid;
          }
      }
      if (left > right) {
          assert(lut[0].range[1] > pos);
          return null;
      }
  
      const found = left;
      const foundPos = lut[found].range[1];
      if(foundPos > pos) {
          return null;
      }
      if (found <= lut.length - 2) {
          const nextPos = lut[found + 1].range[1];
          assert(nextPos > pos);
      }
  
      return lut[found];
  }
docs: binary search lut to find node ending (as in range[1] at or before pos. null if none