JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10610839
  • Score
    100M100P100Q241952F
  • 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 Coverage Downloads Size Sponsors Backers Chat

unist utility to get the positional info of nodes.

Install

npm:

npm install unist-util-position

Usage

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

var tree = remark().parse('# foo\n\n* bar\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 points in the positional info of node.

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

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

Note that in unist, line and column are 1-indexed integers and offset is a 0-indexed integer.

Contribute

See contributing.md in syntax-tree/.github for ways to get started. See support.md for ways to get help.

This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer