HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/api-storage/node_modules/v8-to-istanbul/lib/range.js
/**
 * ...something resembling a binary search, to find the lowest line within the range.
 * And then you could break as soon as the line is longer than the range...
 */
module.exports.sliceRange = (lines, startCol, endCol, inclusive = false) => {
  let start = 0
  let end = lines.length

  if (inclusive) {
    // I consider this a temporary solution until I find an alternaive way to fix the "off by one issue"
    --startCol
  }

  while (start < end) {
    let mid = (start + end) >> 1
    if (startCol >= lines[mid].endCol) {
      start = mid + 1
    } else if (endCol < lines[mid].startCol) {
      end = mid - 1
    } else {
      end = mid
      while (mid >= 0 && startCol < lines[mid].endCol && endCol >= lines[mid].startCol) {
        --mid
      }
      start = mid + 1
      break
    }
  }

  while (end < lines.length && startCol < lines[end].endCol && endCol >= lines[end].startCol) {
    ++end
  }

  return lines.slice(start, end)
}