unist-util-stringify-position

Stringify a Unist Position or Point.
Installation
npm:
npm install unist-util-stringify-position
Usage
var stringify = require('unist-util-stringify-position')
// Point
stringify({line: 2, column: 3}) // => '2:3'
// Position
stringify({
start: {line: 2},
end: {line: 3}
}) // => '2:1-3:1'
// Node
stringify({
type: 'text',
value: '!',
position: {
start: {line: 5, column: 11},
end: {line: 5, column: 12}
}
}) // => '5:11-5:12'
API
stringifyPosition(node|position|point)
Stringify one point, a position (start and end points), or a node’s position.
Parameters
node(Node) — Node whose'position'property to stringifyposition(Position) — Position whose'start'and'end'points to stringifypoint(Point) — Point whose'line'and'column'to stringify
Returns
string? — A range ls:cs-le:ce (when given node or
position) or a point l:c (when given point), where l stands
for line, c for column, s for start, and e for
end. null is returned if the given value is neither node,
position, nor point.
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.