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-5.0.7 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.6 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.5 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.4 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.3 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.2 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.1 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3.5 node_modules/vfile-location/types/index.d.ts
trusty-cms-5.0.0 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3.4 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3.3 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3.2 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3.1 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.3 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.2.3 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.2.2 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.2.1 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.2 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.1.9 node_modules/vfile-location/types/index.d.ts
trusty-cms-4.1.8 node_modules/vfile-location/types/index.d.ts