1717* [ Install] ( #install )
1818* [ Use] ( #use )
1919* [ API] ( #api )
20- * [ ` removePosition(node[, force]) ` ] ( #removepositionnode-force )
20+ * [ ` removePosition(node[, force|options]) ` ] ( #removepositionnode-forceoptions )
21+ * [ ` Options ` ] ( #options )
2122* [ Types] ( #types )
2223* [ Compatibility] ( #compatibility )
2324* [ Contribute] ( #contribute )
@@ -49,7 +50,7 @@ to display positional info to users.
4950## Install
5051
5152This 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] [ ] :
5354
5455``` sh
5556npm install unist-util-remove-position
@@ -58,14 +59,14 @@ npm install unist-util-remove-position
5859In Deno with [ ` esm.sh ` ] [ esmsh ] :
5960
6061``` 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'
6263```
6364
6465In browsers with [ ` esm.sh ` ] [ esmsh ] :
6566
6667``` html
6768<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'
6970 </script >
7071```
7172
@@ -77,7 +78,7 @@ import {removePosition} from 'unist-util-remove-position'
7778
7879const tree = fromMarkdown (' Some _emphasis_, **importance**, and `code`.' )
7980
80- removePosition (tree, true )
81+ removePosition (tree, {force : true } )
8182
8283console .dir (tree, {depth: null })
8384```
@@ -106,29 +107,46 @@ Yields:
106107
107108## API
108109
109- This package exports the identifier ` removePosition ` .
110+ This package exports the identifier [ ` removePosition ` ] [ removeposition ] .
110111There is no default export.
111112
112- ### ` removePosition(node[, force]) `
113+ ### ` removePosition(node[, force|options ]) `
113114
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
117125
118126###### Returns
119127
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 `
121139
122140## Types
123141
124142This package is fully typed with [ TypeScript] [ ] .
125- It exports no additional types .
143+ It exports the additional type [ ` Options ` ] [ options ] .
126144
127145## Compatibility
128146
129147Projects maintained by the unified collective are compatible with all maintained
130148versions 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+.
132150Our projects sometimes work with older versions, but this is not guaranteed.
133151
134152## Contribute
@@ -202,3 +220,7 @@ abide by its terms.
202220[ unist-util-generated ] : https://github.com/syntax-tree/unist-util-generated
203221
204222[ 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