Skip to content

Commit 4a31109

Browse files
committed
Refactor code-style
1 parent a8a37a1 commit 4a31109

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
import {convert} from 'unist-util-is'
1111

1212
/** @type {Array.<Node>} */
13-
var empty
13+
let empty
1414

1515
/**
1616
* @param {Node} node
1717
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} [test]
1818
* @returns {number}
1919
*/
2020
export function size(node, test) {
21-
var is = convert(test)
21+
const is = convert(test)
2222

2323
return fastSize(node)
2424

@@ -28,9 +28,9 @@ export function size(node, test) {
2828
function fastSize(node) {
2929
/** @type {Array.<Node>} */
3030
// @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
3434

3535
if (children && children.length > 0) {
3636
while (++index < children.length) {

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@
6464
"trailingComma": "none"
6565
},
6666
"xo": {
67-
"prettier": true,
68-
"rules": {
69-
"no-var": "off",
70-
"prefer-arrow-callback": "off"
71-
}
67+
"prettier": true
7268
},
7369
"remarkConfig": {
7470
"plugins": [

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ npm install unist-util-size
2727
import {h} from 'hastscript'
2828
import {size} from 'unist-util-size'
2929

30-
var tree = h('div', [
30+
const tree = h('div', [
3131
h('p', [
3232
'Some ',
3333
h('strong', 'importance'),

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import test from 'tape'
22
import h from 'hastscript'
33
import {size} from './index.js'
44

5-
test('unist-util-size', function (t) {
6-
var tree = h('div', [
5+
test('unist-util-size', (t) => {
6+
const tree = h('div', [
77
h('p', [
88
'Some ',
99
h('strong', 'importance'),

0 commit comments

Comments
 (0)