-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
34 lines (28 loc) · 915 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
// TypeScript Version: 3.0
import {Point} from 'unist'
import {VFile} from 'vfile'
declare namespace vfileLocation {
type PositionalPoint = Pick<Point, 'line' | 'column'>
type FullPoint = Required<Point>
type Offset = NonNullable<Point['offset']>
/** @deprecated */
type Position = PositionalPoint
interface Location {
/**
* Get the offset for a line and column based position in the bound file.
* Returns `-1` when given invalid or out of bounds input.
*/
toOffset: (point: PositionalPoint) => Offset
/**
* Get the line and column-based point for offset in the bound file.
*/
toPoint: (offset: Offset) => FullPoint
/** @deprecated */
toPosition: (offset: Offset) => FullPoint
}
}
/**
* Get transform functions for the given `document`.
*/
declare function vfileLocation(document: string | VFile): vfileLocation.Location
export = vfileLocation