-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
47 lines (44 loc) · 990 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type {Point as UnistPoint} from 'unist'
export {location} from './lib/index.js'
/**
* Accessors for index.
*/
export interface Location {
/**
* Get the `offset` from a line/column based `Point` in the bound indices;
* returns `undefined` when given out of bounds input.
*
* @param point
* Line/column based `Point`.
* @returns
* Offset.
*/
toOffset(point?: PointLike | null | undefined): number | undefined
/**
* Get the line/column based `Point` for `offset` in the bound indices;
* returns `undefined` when given out of bounds input.
*
* @param offset
* Offset.
* @returns
* `Point`.
*/
toPoint(offset?: number | null | undefined): UnistPoint | undefined
}
/**
* Point from `unist`, allowed as input.
*/
interface PointLike {
/**
* Column.
*/
column?: number | null | undefined
/**
* Line.
*/
line?: number | null | undefined
/**
* Offset.
*/
offset?: number | null | undefined
}