File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 9
9
10
10
import { convert } from 'unist-util-is'
11
11
12
- /** @type {Array. <Node> } */
12
+ /** @type {Array<Node> } */
13
13
let empty
14
14
15
15
/**
16
+ * Calculate the number of nodes in `node`.
17
+ *
16
18
* @param {Node } node
19
+ * Tree to traverse.
17
20
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything> } [test]
21
+ * `unist-util-is`-compatible test (such as a node type).
18
22
* @returns {number }
23
+ * Number of exclusive descendants that pass `test` in `tree`.
19
24
*/
20
25
export function size ( node , test ) {
21
26
const is = convert ( test )
@@ -26,7 +31,7 @@ export function size(node, test) {
26
31
* @param {Node } node
27
32
*/
28
33
function fastSize ( node ) {
29
- /** @type {Array. <Node> } */
34
+ /** @type {Array<Node> } */
30
35
// @ts -expect-error Looks like a parent.
31
36
const children = ( node && node . children ) || empty
32
37
let count = 0
You can’t perform that action at this time.
0 commit comments