Location

API reference for locations in Plate.

A Location is either a Path, Point or Range. Methods will often accept a Location instead of requiring only a Path, Point or Range.

type TLocation = Path | Point | TRange

LocationApi

isAt

Check if a value implements the At interface.

Parameters

  • value any

    The value to check.

Returnsboolean

    true if the value is either a location or a node.

isLocation

Check if a value implements the TLocation interface.

Parameters

Collapse all
  • value any

    The value to check.

Returnsboolean

    true if the value is a Path, Point, or TRange.

isSpan

Check if a value implements the Span interface.

Parameters

Collapse all
  • value any

    The value to check.

Returnsboolean

    true if the value is a valid Span.

Types

TLocation

Location is a type alias for TLocation.

Attributes

Collapse all
  • Path Path

    An array of numbers representing a node's position.

  • Point Point

    An object with path and offset.

  • TRange TRange

    An object with anchor and focus.

Span

Attributes

Collapse all
  • [0] Path

    The start path.

  • [1] Path

    The end path.