File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 1
- var own = { } . hasOwnProperty
2
-
3
1
/**
4
- * @typedef {Record<string, unknown> & {type: string, position?: Position|undefined} } NodeLike
5
- * @typedef {import('unist').Position } Position
6
2
* @typedef {import('unist').Point } Point
3
+ * @typedef {import('unist').Position } Position
4
+ * @typedef {Record<string, unknown> & {type: string, position?: Position|undefined} } NodeLike
7
5
*/
8
6
9
7
/**
@@ -20,20 +18,17 @@ export function stringifyPosition(value) {
20
18
}
21
19
22
20
// Node.
23
- if ( own . call ( value , 'position' ) || own . call ( value , 'type' ) ) {
24
- // @ts -expect-error looks like a node.
21
+ if ( 'position' in value || 'type' in value ) {
25
22
return position ( value . position )
26
23
}
27
24
28
25
// Position.
29
- if ( own . call ( value , 'start' ) || own . call ( value , 'end' ) ) {
30
- // @ts -expect-error looks like a position.
26
+ if ( 'start' in value || 'end' in value ) {
31
27
return position ( value )
32
28
}
33
29
34
30
// Point.
35
- if ( own . call ( value , 'line' ) || own . call ( value , 'column' ) ) {
36
- // @ts -expect-error looks like a point.
31
+ if ( 'line' in value || 'column' in value ) {
37
32
return point ( value )
38
33
}
39
34
You can’t perform that action at this time.
0 commit comments