docs: function findClosestElementInSortedArray(ary, mapFn, val, maxDiff) {
      if (ary.length === 0)
        return null;
  
      var aftIdx = findLowIndexInSortedArray(ary, mapFn, val);
      var befIdx = aftIdx > 0 ? aftIdx - 1 : 0;
  
      if (aftIdx === ary.length)
        aftIdx -= 1;
  
      var befDiff = Math.abs(val - mapFn(ary[befIdx]));
      var aftDiff = Math.abs(val - mapFn(ary[aftIdx]));
  
      if (befDiff > maxDiff && aftDiff > maxDiff)
        return null;
  
      var idx = befDiff < aftDiff ? befIdx : aftIdx;
      return ary[idx];
    }