Skip to content

Commit 238e6e4

Browse files
committed
Refactor code-style
* Add more docs to JSDoc * Add support for `null` in input of API types
1 parent b9a97e0 commit 238e6e4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@ import {visit} from 'unist-util-visit'
88
* Remove the `position` field from a tree.
99
*
1010
* @template {Node} Tree
11-
* @param {Tree} node
12-
* The unist tree.
13-
* @param {boolean} [force=false]
14-
* If `force` is given (`boolean`, default: `false`), uses `delete` to remove
15-
* the field entirely, otherwise it’s set to `undefined`.
11+
* Node type.
12+
* @param {Tree} tree
13+
* Tree to clean.
14+
* @param {boolean | null | undefined} [force=false]
15+
* Whether to use `delete` to remove `position` fields.
16+
*
17+
* The default is to set them to `undefined`.
1618
* @returns {Tree}
17-
* The given, modified, `node`.
19+
* The given, modified, `tree`.
1820
*/
19-
export function removePosition(node, force) {
20-
visit(node, remove)
21+
// To do: next major: return `void`.
22+
// To do: remove `force` shortcut, replace with options.
23+
export function removePosition(tree, force) {
24+
visit(tree, remove)
2125

22-
return node
26+
return tree
2327

2428
/**
2529
* @param {Node} node

0 commit comments

Comments
 (0)