Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 26, 2021
1 parent f2b1dd1 commit e02b8b7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @param {Options} [options]
* @returns {string}
*/
export function toString(node, options) {
var {includeImageAlt = true} = options || {}
export function toString(node, options = {}) {
const {includeImageAlt = true} = options
return one(node, includeImageAlt)
}

Expand Down Expand Up @@ -44,8 +44,8 @@ function one(node, includeImageAlt) {
*/
function all(values, includeImageAlt) {
/** @type {Array.<string>} */
var result = []
var index = -1
const result = []
let index = -1

while (++index < values.length) {
result[index] = one(values[index], includeImageAlt)
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
}
"prettier": true
},
"remarkConfig": {
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ npm install mdast-util-to-string
## Use

```js
import unified from 'unified'
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import {toString} from 'mdast-util-to-string'

var tree = unified()
const tree = unified()
.use(remarkParse)
.parse('Some _emphasis_, **importance**, and `code`.')

Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'tape'
import {toString} from './index.js'

test('toString', function (t) {
test('toString', (t) => {
t.equal(toString(), '', 'should not fail on a missing node')
t.equal(toString(null), '', 'should not fail on `null` missing node')

Expand Down

0 comments on commit e02b8b7

Please sign in to comment.