Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
*   Add more docs to JSDoc
*   Add support for `null` in input of API types
  • Loading branch information
wooorm committed Jan 23, 2023
1 parent b9a97e0 commit 238e6e4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ import {visit} from 'unist-util-visit'
* Remove the `position` field from a tree.
*
* @template {Node} Tree
* @param {Tree} node
* The unist tree.
* @param {boolean} [force=false]
* If `force` is given (`boolean`, default: `false`), uses `delete` to remove
* the field entirely, otherwise it’s set to `undefined`.
* Node type.
* @param {Tree} tree
* Tree to clean.
* @param {boolean | null | undefined} [force=false]
* Whether to use `delete` to remove `position` fields.
*
* The default is to set them to `undefined`.
* @returns {Tree}
* The given, modified, `node`.
* The given, modified, `tree`.
*/
export function removePosition(node, force) {
visit(node, remove)
// To do: next major: return `void`.
// To do: remove `force` shortcut, replace with options.
export function removePosition(tree, force) {
visit(tree, remove)

return node
return tree

/**
* @param {Node} node
Expand Down

0 comments on commit 238e6e4

Please sign in to comment.