Skip to content

Commit

Permalink
Change to return undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 6, 2023
1 parent 45ec440 commit 45cb3fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
11 changes: 3 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ const max = 6
* Make sure that there is only one top-level heading in the document by
* adjusting headings depths accordingly.
*
* @template {Node} Tree
* Node type.
* @param {Tree} tree
* @param {Node} tree
* Tree to change.
* @returns {Tree}
* Given, modified, `tree`.
* @returns {undefined}
* Nothing.
*/
// To do: next major: don’t return `tree`.
export function normalizeHeadings(tree) {
/** @type {Array<Heading>} */
const all = []
Expand Down Expand Up @@ -66,6 +63,4 @@ export function normalizeHeadings(tree) {
}
}
}

return tree
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ headings depths accordingly.

###### Returns

Given, modified, `tree` ([`Node`][node]).
Nothing (`undefined`).

## Types

Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ test('normalizeHeadings', async function (t) {
)
const actual = fromMarkdown(input)
const expected = fromMarkdown(output)

normalizeHeadings(actual)
removePosition(actual, true)
removePosition(expected, true)

assert.deepEqual(
removePosition(actual, true),
removePosition(expected, true)
)
assert.deepEqual(actual, expected)
})
}
})

0 comments on commit 45cb3fc

Please sign in to comment.