code: function rangeFromIndexAndOffsets(i, before, after, length) {
    return {
      // Guard against the negative upper bound for lines included in the output.
      from: i - before > 0 ? i - before : 0,
      to: i + after > length ? length : i + after
    };
  }
docs: Get a range of indexes including `i`-th element and `before` and `after` amount of elements from `arr`.