Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

unist-util-position

3.0.2 • Public • Published

unist-util-position Build Status Coverage Status

unist utility to get the positional info 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 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).

Contribute

See contributing.md in syntax-tree/unist for ways to get started.

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

License

MIT © Titus Wormer

install

npm i unist-util-position

Downloadsweekly downloads

226,569

version

3.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability