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

unist utility to get the position of nodes.
Installation
npm:
npm install unist-util-position
unist-util-position is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.
Usage
var remark = require('remark');
var position = require('unist-util-position');
var ast = remark().parse([
'# foo',
'',
'* bar',
''
].join('\n'));
position.start(ast) // {line: 1, column: 1}
position.end(ast) // {line: 4, column: 1}
position.generated(ast) // false
position.start() // {line: null, column: null}
position.end() // {line: null, column: null}
position.generated() // true
API
position.start([node])
position.end([node])
Get the bound position of node
.
Parameters
node
(Node?
) — Node to check.
Returns
Position
— Filled with line
(nullable uint32 >= 1
),
column
(nullable uint32 >= 1
), offset
(nullable uint32 >= 0
).
position.generated([node])
Get the heading style of a node.
Parameters
node
(Node
) — Node to check;
Returns
boolean
— Whether or not node
has positional information (both
starting and ending lines and columns). This is useful when checking
if a node is inserted by plug-ins.