File tree Expand file tree Collapse file tree 4 files changed +9
-13
lines changed Expand file tree Collapse file tree 4 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 10
10
import { convert } from 'unist-util-is'
11
11
12
12
/** @type {Array.<Node> } */
13
- var empty
13
+ let empty
14
14
15
15
/**
16
16
* @param {Node } node
17
17
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything> } [test]
18
18
* @returns {number }
19
19
*/
20
20
export function size ( node , test ) {
21
- var is = convert ( test )
21
+ const is = convert ( test )
22
22
23
23
return fastSize ( node )
24
24
@@ -28,9 +28,9 @@ export function size(node, test) {
28
28
function fastSize ( node ) {
29
29
/** @type {Array.<Node> } */
30
30
// @ts -ignore Looks like a parent.
31
- var children = ( node && node . children ) || empty
32
- var count = 0
33
- var index = - 1
31
+ const children = ( node && node . children ) || empty
32
+ let count = 0
33
+ let index = - 1
34
34
35
35
if ( children && children . length > 0 ) {
36
36
while ( ++ index < children . length ) {
Original file line number Diff line number Diff line change 64
64
"trailingComma" : " none"
65
65
},
66
66
"xo" : {
67
- "prettier" : true ,
68
- "rules" : {
69
- "no-var" : " off" ,
70
- "prefer-arrow-callback" : " off"
71
- }
67
+ "prettier" : true
72
68
},
73
69
"remarkConfig" : {
74
70
"plugins" : [
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ npm install unist-util-size
27
27
import {h } from ' hastscript'
28
28
import {size } from ' unist-util-size'
29
29
30
- var tree = h (' div' , [
30
+ const tree = h (' div' , [
31
31
h (' p' , [
32
32
' Some ' ,
33
33
h (' strong' , ' importance' ),
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import test from 'tape'
2
2
import h from 'hastscript'
3
3
import { size } from './index.js'
4
4
5
- test ( 'unist-util-size' , function ( t ) {
6
- var tree = h ( 'div' , [
5
+ test ( 'unist-util-size' , ( t ) => {
6
+ const tree = h ( 'div' , [
7
7
h ( 'p' , [
8
8
'Some ' ,
9
9
h ( 'strong' , 'importance' ) ,
You can’t perform that action at this time.
0 commit comments