unist-util-position
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -23,2 +23,7 @@ /** | ||
export type Position = import('unist').Position | ||
export type Node = import('unist').Node | ||
export type NodeLike = Record<string, unknown> & { | ||
type: string | ||
position?: PositionLike | undefined | ||
} | ||
export type Point = import('unist').Point | ||
@@ -30,4 +35,1 @@ export type PointLike = Partial<Point> | ||
} | ||
export type NodeLike = { | ||
position?: PositionLike | ||
} |
15
index.js
/** | ||
* @typedef {import('unist').Position} Position | ||
* @typedef {import('unist').Node} Node | ||
* @typedef {Record<string, unknown> & {type: string, position?: PositionLike|undefined}} NodeLike | ||
* @typedef {import('unist').Point} Point | ||
@@ -7,12 +9,9 @@ * | ||
* | ||
* @typedef {Object} PositionLike | ||
* @typedef PositionLike | ||
* @property {PointLike} [start] | ||
* @property {PointLike} [end] | ||
* | ||
* @typedef {Object} NodeLike | ||
* @property {PositionLike} [position] | ||
*/ | ||
export var pointStart = point('start') | ||
export var pointEnd = point('end') | ||
export const pointStart = point('start') | ||
export const pointEnd = point('end') | ||
@@ -45,4 +44,4 @@ /** | ||
/** @type {Point} */ | ||
// @ts-ignore looks like a point | ||
var point = (node && node.position && node.position[type]) || {} | ||
// @ts-expect-error looks like a point | ||
const point = (node && node.position && node.position[type]) || {} | ||
@@ -49,0 +48,0 @@ return { |
{ | ||
"name": "unist-util-position", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "unist utility to get the position of a node", | ||
@@ -33,2 +33,5 @@ "license": "MIT", | ||
], | ||
"dependencies": { | ||
"@types/unist": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -38,4 +41,4 @@ "@types/tape": "^4.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"remark-cli": "^10.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"rimraf": "^3.0.0", | ||
@@ -45,3 +48,3 @@ "tape": "^5.0.0", | ||
"typescript": "^4.0.0", | ||
"xo": "^0.39.0" | ||
"xo": "^0.48.0" | ||
}, | ||
@@ -65,8 +68,3 @@ "scripts": { | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"import/no-mutable-exports": "off", | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off" | ||
} | ||
"prettier": true | ||
}, | ||
@@ -73,0 +71,0 @@ "remarkConfig": { |
@@ -27,6 +27,6 @@ # unist-util-position | ||
```js | ||
import remark from 'remark' | ||
import {remark} from 'remark' | ||
import {position, pointStart, pointEnd} from 'unist-util-position' | ||
var tree = remark().parse('# foo\n\n* bar\n') | ||
const tree = remark().parse('# foo\n\n* bar\n') | ||
@@ -33,0 +33,0 @@ console.log(position(tree)) |
8483
80
1
+ Added@types/unist@^2.0.0
+ Added@types/unist@2.0.10(transitive)