A range represents an ordered pair of two positions. It is guaranteed that {@link Range.start start}.isBeforeOrEqual({@link Range.end end})
Range objects are immutable. Use the {@link Range. with with}, {@link Range.intersection intersection}, or {@link Range.union union} methods to derive new ranges from an existing range.
A range represents an ordered pair of two positions. It is guaranteed that {@link Range.start start}.isBeforeOrEqual({@link Range.end end}) Range objects are __immutable__. Use the {@link Range. with with}, {@link Range.intersection intersection}, or {@link Range.union union} methods to derive new ranges from an existing range.
(contains? range position-or-range)
Check if a position or a range is contained in this range.
Parameters:
position-or-range
: Range | Position
- A position or a range.Returns: boolean
- true
if the position or range is inside or equal
to this range.
Check if a position or a range is contained in this range. **Parameters:** - `position-or-range`: `Range | Position` - A position or a range. **Returns:** `boolean` - `true` if the position or range is inside or equal to this range.
(empty? range)
true
if start
and end
are equal.
Returns: boolean
`true` if `start` and `end` are equal. **Returns:** `boolean`
(end range)
The end position. It is after or equal to {@link Range.start start}.
Returns: Position
The end position. It is after or equal to {@link Range.start start}. **Returns:** `Position`
(equal? range other)
Check if other
equals this range.
Parameters:
other
: Range
- A range.Returns: boolean
- true
when start and end are {@link Position.isEqualequal} to
start and end of this range.
Check if `other` equals this range. **Parameters:** - `other`: `Range` - A range. **Returns:** `boolean` - `true` when start and end are {@link Position.isEqualequal} to start and end of this range.
(intersection this-range range)
Intersect range
with this range and returns a new range or undefined
if the ranges have no overlap.
Parameters:
range
: Range
- A range.Returns: Range | undefined
- A range of the greater start and smaller end positions. Will
return undefined when there is no overlap.
Intersect `range` with this range and returns a new range or `undefined` if the ranges have no overlap. **Parameters:** - `range`: `Range` - A range. **Returns:** `Range | undefined` - A range of the greater start and smaller end positions. Will return undefined when there is no overlap.
(set-is-empty! range value)
true
if start
and end
are equal.
`true` if `start` and `end` are equal.
(set-is-single-line! range value)
true
if start.line
and end.line
are equal.
`true` if `start.line` and `end.line` are equal.
(single-line? range)
true
if start.line
and end.line
are equal.
Returns: boolean
`true` if `start.line` and `end.line` are equal. **Returns:** `boolean`
(start range)
The start position. It is before or equal to {@link Range.end end}.
Returns: Position
The start position. It is before or equal to {@link Range.end end}. **Returns:** `Position`
(union range other)
Compute the union of other
with this range.
Parameters:
other
: Range
- A range.Returns: Range
- A range of smaller start position and the greater end position.
Compute the union of `other` with this range. **Parameters:** - `other`: `Range` - A range. **Returns:** `Range` - A range of smaller start position and the greater end position.
(with range)
(with range change)
(with range start)
(with range start end)
Derived a new range from this range.
Parameters:
change
: { start?: Position | undefined; end?: Position | undefined; }
- An object that describes a change to this range.start
: Position | undefined
- A position that should be used as start. The default value is the {@link Range.start current start}.end
: Position | undefined
- A position that should be used as end. The default value is the {@link Range.end current end}.Returns: Range
- A range that reflects the given change. Will return this
range if the change
is not changing anything.
Derived a new range from this range. **Parameters:** - `change`: `{ start?: Position | undefined; end?: Position | undefined; }` - An object that describes a change to this range. - `start`: `Position | undefined` - A position that should be used as start. The default value is the {@link Range.start current start}. - `end`: `Position | undefined` - A position that should be used as end. The default value is the {@link Range.end current end}. **Returns:** `Range` - A range that reflects the given change. Will return `this` range if the change is not changing anything.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close