Skip to content

Commit 7959f77

Browse files
committed
Add improved jsdoc
1 parent e1c85e0 commit 7959f77

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99

1010
import {convert} from 'unist-util-is'
1111

12-
/** @type {Array.<Node>} */
12+
/** @type {Array<Node>} */
1313
let empty
1414

1515
/**
16+
* Calculate the number of nodes in `node`.
17+
*
1618
* @param {Node} node
19+
* Tree to traverse.
1720
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} [test]
21+
* `unist-util-is`-compatible test (such as a node type).
1822
* @returns {number}
23+
* Number of exclusive descendants that pass `test` in `tree`.
1924
*/
2025
export function size(node, test) {
2126
const is = convert(test)
@@ -26,7 +31,7 @@ export function size(node, test) {
2631
* @param {Node} node
2732
*/
2833
function fastSize(node) {
29-
/** @type {Array.<Node>} */
34+
/** @type {Array<Node>} */
3035
// @ts-expect-error Looks like a parent.
3136
const children = (node && node.children) || empty
3237
let count = 0

0 commit comments

Comments
 (0)