JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9173682
  • Score
    100M100P100Q233410F
  • License MIT

Utility to get the position of unist nodes

Package Exports

  • unist-util-position

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unist-util-position) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

unist-util-position Build Status Coverage Status

unist utility to get the position of nodes.

Installation

npm:

npm install unist-util-position

Usage

var remark = require('remark');
var position = require('unist-util-position');

var tree = remark().parse([
  '# foo',
  '',
  '* bar',
  ''
].join('\n'));

position.start(tree); //=> {line: 1, column: 1}
position.end(tree); //=> {line: 4, column: 1}

position.start(); //=> {line: null, column: null}
position.end(); //=> {line: null, column: null}

API

position.start([node])

position.end([node])

Get the start or end position, respectively, of node.

Parameters
  • node (Node?) — Node to check.
Returns

Position — Filled with line (nullable uint32 >= 1), column (nullable uint32 >= 1), offset (nullable uint32 >= 0).

License

MIT © Titus Wormer