17
17
* [ Install] ( #install )
18
18
* [ Use] ( #use )
19
19
* [ API] ( #api )
20
- * [ ` removePosition(node[, force]) ` ] ( #removepositionnode-force )
20
+ * [ ` removePosition(node[, force|options]) ` ] ( #removepositionnode-forceoptions )
21
+ * [ ` Options ` ] ( #options )
21
22
* [ Types] ( #types )
22
23
* [ Compatibility] ( #compatibility )
23
24
* [ Contribute] ( #contribute )
@@ -49,7 +50,7 @@ to display positional info to users.
49
50
## Install
50
51
51
52
This package is [ ESM only] [ esm ] .
52
- In Node.js (version 12.20+, 14.14+, 16.0+, 18 .0+), install with [ npm] [ ] :
53
+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
53
54
54
55
``` sh
55
56
npm install unist-util-remove-position
@@ -58,14 +59,14 @@ npm install unist-util-remove-position
58
59
In Deno with [ ` esm.sh ` ] [ esmsh ] :
59
60
60
61
``` js
61
- import {removePosition } from " https://esm.sh/unist-util-remove-position@4"
62
+ import {removePosition } from ' https://esm.sh/unist-util-remove-position@4'
62
63
```
63
64
64
65
In browsers with [ ` esm.sh ` ] [ esmsh ] :
65
66
66
67
``` html
67
68
<script type =" module" >
68
- import {removePosition } from " https://esm.sh/unist-util-remove-position@4?bundle"
69
+ import {removePosition } from ' https://esm.sh/unist-util-remove-position@4?bundle'
69
70
</script >
70
71
```
71
72
@@ -77,7 +78,7 @@ import {removePosition} from 'unist-util-remove-position'
77
78
78
79
const tree = fromMarkdown (' Some _emphasis_, **importance**, and `code`.' )
79
80
80
- removePosition (tree, true )
81
+ removePosition (tree, {force : true } )
81
82
82
83
console .dir (tree, {depth: null })
83
84
```
@@ -106,29 +107,46 @@ Yields:
106
107
107
108
## API
108
109
109
- This package exports the identifier ` removePosition ` .
110
+ This package exports the identifier [ ` removePosition ` ] [ removeposition ] .
110
111
There is no default export.
111
112
112
- ### ` removePosition(node[, force]) `
113
+ ### ` removePosition(node[, force|options ]) `
113
114
114
- Remove the ` position ` field from a tree ([ ` Node ` ] [ node ] ).
115
- If ` force ` is given (` boolean ` , default: ` false ` ), uses ` delete ` to remove the
116
- field entirely, otherwise it’s set to ` undefined ` .
115
+ Remove the ` position ` field from a tree.
116
+
117
+ ###### Parameters
118
+
119
+ * ` node ` ([ ` Node ` ] [ node ] )
120
+ — tree to clean
121
+ * ` force ` (` boolean ` )
122
+ — equivalent to ` {force: boolean} `
123
+ * ` options ` ([ ` Options ` ] [ options ] , optional)
124
+ — configuration
117
125
118
126
###### Returns
119
127
120
- The given, modified, ` node ` ([ ` Node ` ] [ node ] ).
128
+ The given, modified, ` tree ` ([ ` Node ` ] [ node ] ).
129
+
130
+ ### ` Options `
131
+
132
+ Configuration (TypeScript type).
133
+
134
+ ###### Fields
135
+
136
+ * ` force ` (` boolean ` , default: ` false ` )
137
+ — whether to use ` delete ` to remove ` position ` fields, the default is to
138
+ set them to ` undefined `
121
139
122
140
## Types
123
141
124
142
This package is fully typed with [ TypeScript] [ ] .
125
- It exports no additional types .
143
+ It exports the additional type [ ` Options ` ] [ options ] .
126
144
127
145
## Compatibility
128
146
129
147
Projects maintained by the unified collective are compatible with all maintained
130
148
versions of Node.js.
131
- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
149
+ As of now, that is Node.js 14.14+ and 16 .0+.
132
150
Our projects sometimes work with older versions, but this is not guaranteed.
133
151
134
152
## Contribute
@@ -202,3 +220,7 @@ abide by its terms.
202
220
[ unist-util-generated ] : https://github.com/syntax-tree/unist-util-generated
203
221
204
222
[ unist-util-stringify-position ] : https://github.com/syntax-tree/unist-util-stringify-position
223
+
224
+ [ removeposition ] : #removepositionnode-forceoptions
225
+
226
+ [ options ] : #options
0 commit comments