This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/vfile-location/types/index.d.ts

35 lines
915 B
TypeScript

// 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