Skip to content

Commit e02b8b7

Browse files
committed
Refactor code-style
1 parent f2b1dd1 commit e02b8b7

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* @param {Options} [options]
1313
* @returns {string}
1414
*/
15-
export function toString(node, options) {
16-
var {includeImageAlt = true} = options || {}
15+
export function toString(node, options = {}) {
16+
const {includeImageAlt = true} = options
1717
return one(node, includeImageAlt)
1818
}
1919

@@ -44,8 +44,8 @@ function one(node, includeImageAlt) {
4444
*/
4545
function all(values, includeImageAlt) {
4646
/** @type {Array.<string>} */
47-
var result = []
48-
var index = -1
47+
const result = []
48+
let index = -1
4949

5050
while (++index < values.length) {
5151
result[index] = one(values[index], includeImageAlt)

package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@
6161
"trailingComma": "none"
6262
},
6363
"xo": {
64-
"prettier": true,
65-
"rules": {
66-
"no-var": "off",
67-
"prefer-arrow-callback": "off"
68-
}
64+
"prettier": true
6965
},
7066
"remarkConfig": {
7167
"plugins": [

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ npm install mdast-util-to-string
2424
## Use
2525

2626
```js
27-
import unified from 'unified'
27+
import {unified} from 'unified'
2828
import remarkParse from 'remark-parse'
2929
import {toString} from 'mdast-util-to-string'
3030

31-
var tree = unified()
31+
const tree = unified()
3232
.use(remarkParse)
3333
.parse('Some _emphasis_, **importance**, and `code`.')
3434

test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'tape'
22
import {toString} from './index.js'
33

4-
test('toString', function (t) {
4+
test('toString', (t) => {
55
t.equal(toString(), '', 'should not fail on a missing node')
66
t.equal(toString(null), '', 'should not fail on `null` missing node')
77

0 commit comments

Comments
 (0)