Sha256: 9a1bc241d66e6a20abf4a4aface06382fe210f9826ae309a0f968cbbcd1cad00

Contents?: true

Size: 804 Bytes

Versions: 23

Compression:

Stored size: 804 Bytes

Contents

// TypeScript Version: 3.0

import {Point} from 'unist'
import {VFile} from 'vfile'

declare namespace vfileLocation {
  type Position = Pick<Point, 'line' | 'column'>
  type PositionWithOffset = Required<Point>
  type Offset = NonNullable<Point['offset']>

  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: (position: Position) => Offset

    /**
     * Get the line and column-based position for offset in the bound file.
     */
    toPosition: (offset: Offset) => PositionWithOffset
  }
}

/**
 * Get transform functions for the given `document`.
 */
declare function vfileLocation(document: string | VFile): vfileLocation.Location

export = vfileLocation

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-4.1.7 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.1.6 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.1.5 node_modules/vfile-location/types/index.d.ts