Skip to content

Commit 349464c

Browse files
committed
Update unist-util-visit
1 parent 24a5a91 commit 349464c

File tree

2 files changed

+39
-51
lines changed

2 files changed

+39
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"tape": "^5.0.0",
4646
"type-coverage": "^2.0.0",
4747
"typescript": "^4.0.0",
48-
"unist-util-visit": "^3.0.0",
48+
"unist-util-visit": "^4.0.0",
4949
"xo": "^0.42.0"
5050
},
5151
"scripts": {

test.js

Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,12 @@ test('isLiteral()', (t) => {
5353
}, 'should not throw if `node` is in `parent`')
5454

5555
t.doesNotThrow(() => {
56-
process(
57-
'Well? Ha! Funky',
58-
/** @type {Visitor} */ (_, index, parent) => {
59-
assert.strictEqual(
60-
parent && index !== null && isLiteral(parent, index),
61-
false
62-
)
63-
}
64-
)
56+
process('Well? Ha! Funky', (_, index, parent) => {
57+
assert.strictEqual(
58+
parent && index !== null && isLiteral(parent, index),
59+
false
60+
)
61+
})
6562
}, 'should work on single word sentences')
6663

6764
t.doesNotThrow(() => {
@@ -79,16 +76,13 @@ test('isLiteral()', (t) => {
7976
let index = -1
8077

8178
while (++index < fixtures.length) {
82-
process(
83-
fixtures[index],
84-
/** @type {Visitor} */ (_, index, parent) => {
85-
assert.strictEqual(
86-
parent && index !== null && isLiteral(parent, index),
87-
index === 0,
88-
String(index)
89-
)
90-
}
91-
)
79+
process(fixtures[index], (_, index, parent) => {
80+
assert.strictEqual(
81+
parent && index !== null && isLiteral(parent, index),
82+
index === 0,
83+
String(index)
84+
)
85+
})
9286
}
9387
}, 'Initial')
9488

@@ -107,16 +101,13 @@ test('isLiteral()', (t) => {
107101
let index = -1
108102

109103
while (++index < fixtures.length) {
110-
process(
111-
fixtures[index],
112-
/** @type {Visitor} */ (_, index, parent) => {
113-
assert.strictEqual(
114-
parent && index !== null && isLiteral(parent, index),
115-
parent && index === parent.children.length - 2,
116-
String(index)
117-
)
118-
}
119-
)
104+
process(fixtures[index], (_, index, parent) => {
105+
assert.strictEqual(
106+
parent && index !== null && isLiteral(parent, index),
107+
parent && index === parent.children.length - 2,
108+
String(index)
109+
)
110+
})
120111
}
121112
}, 'Final')
122113

@@ -152,28 +143,25 @@ test('isLiteral()', (t) => {
152143
let index = -1
153144

154145
while (++index < fixtures.length) {
155-
process(
156-
fixtures[index],
157-
/** @type {Visitor} */ (_, place, parent) => {
158-
let pos = 5
159-
160-
// Adjacent hyphens are part of the word.
161-
if (index === 1) {
162-
pos = 4
163-
}
164-
165-
// Tests for extra spaces.
166-
if (index === 4 || index === 5 || index === 6) {
167-
pos = 6
168-
}
169-
170-
assert.strictEqual(
171-
parent && place !== null && isLiteral(parent, place),
172-
place === pos,
173-
String(index)
174-
)
146+
process(fixtures[index], (_, place, parent) => {
147+
let pos = 5
148+
149+
// Adjacent hyphens are part of the word.
150+
if (index === 1) {
151+
pos = 4
175152
}
176-
)
153+
154+
// Tests for extra spaces.
155+
if (index === 4 || index === 5 || index === 6) {
156+
pos = 6
157+
}
158+
159+
assert.strictEqual(
160+
parent && place !== null && isLiteral(parent, place),
161+
place === pos,
162+
String(index)
163+
)
164+
})
177165
}
178166
}, 'Internal')
179167

0 commit comments

Comments
 (0)