# Source: https://docs.slatejs.org/api/locations/point.md

# Source: https://docs.slatejs.org/v0.47/slate-core/point.md

# Point

```javascript
import { Point } from 'slate'
```

A point in a Slate [`Document`](https://docs.slatejs.org/v0.47/slate-core/document). Points in Slate are inspired by the [DOM Range API](https://developer.mozilla.org/en-US/docs/Web/API/Range), with terms like "offset".

## Properties

```javascript
Point({
  key: String,
  path: List,
  offset: Number,
})
```

### `key`

`String`

The key of the text node at the point's point.

### `path`

`List`

The path to the text node at the point's point.

### `object`

`String`

A string with a value of `'point'`.

### `offset`

`Number`

The number of characters from the start of the text node at the point's point.

## Computed Properties

### `isSet`

`Boolean`

Whether the key, path and offset of a point is not `null`.

### `isUnset`

`Boolean`

Whether any of the key, path or offset of a point is `null`.

## Static Methods

### `Point.create`

`Point.create(properties: Object|Point) => Point`

Create a new `Point` with `properties`.

### `Point.createProperties`

`Point.createProperties(object: Object|Point) => Object`

Create a new dictionary of point properties from an `object`.

### `Point.fromJSON`

`Point.fromJSON(object: Object) => Point`

Create a point from a JSON `object`.

### `Point.isPoint`

`Point.isPoint(value: Any) => Boolean`

Check whether a `value` is a `Point`.

## Instance Methods

### `toJSON`

`toJSON() => Object`

Return a JSON representation of the point.

## Checking Methods

### `isAfterRange`

`isAfterRange(range: Range) => Boolean`

Determine whether the point is after a `range`.

### `isAtEndOfRange`

`isAtEndOfRange(range: Range) => Boolean`

Determine whether the point is at the end of a `range`.

### `isAtStartOfRange`

`isAtStartOfRange(range: Range) => Boolean`

Determine whether the point is at the start of a `range`.

### `isBeforeRange`

`isBeforeRange(range: Range) => Boolean`

Determine whether the point is before a `range`.

### `isInRange`

`isInRange(range: Range) => Boolean`

Determine whether the point is inside a `range`.

### `isAtEndOfNode`

`isAtEndOfNode(node: Node) => Boolean`

Determine whether the point is at the end of a `node`.

### `isAtStartOfNode`

`isAtStartOfNode(node: Node) => Boolean`

Determine whether the point is at the start of a `node`.

### `isInNode`

`isInNode(node: Node) => Boolean`

Determine whether a point is inside a `node`.

## Mutating Methods

### `moveBackward`

`moveBackward(n: Number) => Point`

Return a new point with its offset moved backwards by `n` characters.

### `moveForward`

`moveForward(n: Number) => Point`

Return a new point with its offset moved forwards by `n` characters.

### `moveTo`

`moveTo(path: List, offset: Number) => Point` `moveTo(key: String, offset: Number) => Point` `moveTo(offset: Number) => Point`

Return a new point with its `path`, `key` and `offset` set to new values.

> 🤖 When using `point.moveTo`, since the point isn't aware of the document, it's possible it will become "unset" if the path or key changes and need to be re-normalized relative to the document using `point.normalize(document)`.

### `moveToEndOfNode`

`moveToEndOfNode(node: Node) => Point`

Return a new point at the end of a `node`.

> 🤖 This method may need to be followed by `point.normalize(document)`, like [`moveTo`](#moveto).

### `moveToStartOfNode`

`moveToStartOfNode(node: Node) => Point`

Return a new point at the start of a `node`.

> 🤖 This method may need to be followed by `point.normalize(document)`, like [`moveTo`](#moveto).

### `normalize`

`normalize(node: Node) => Point`

Normalize the point relative to a `node`, ensuring that its key and path are in sync, that its offset is valid, and that it references a leaf text node.

### `setKey`

`setKey(key: String|Null) => Point`

Return a new point with a new `key`.

### `setOffset`

`setOffset(offset: Number|Null) => Point`

Return a new point with a new `offset`.

### `setPath`

`setPath(path: List|Array|Null) => Point`

Return a new point with a new `path`.

### `unset`

`unset() => Point`

Return a new point with the key, path, and offset all set to `null`.