Skip to content

Commit e38d9ee

Browse files
committed
Change to yield undefined
1 parent 7eaa2b4 commit e38d9ee

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

lib/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ import {convert} from 'unist-util-is'
1717
* @param {Parent} parent
1818
* @param {Node | number} index
1919
* @param {import('unist-util-is').PredicateTest<Kind>} test
20-
* @returns {Kind | null}
20+
* @returns {Kind | undefined}
2121
*
2222
* @overload
2323
* @param {Parent} parent
2424
* @param {Node | number} index
2525
* @param {Test} [test]
26-
* @returns {Node | null}
26+
* @returns {Node | undefined}
2727
*
2828
* @param {Parent} parent
2929
* Parent node.
3030
* @param {Node | number} index
3131
* Child of `parent` or it’s index.
3232
* @param {Test} [test]
3333
* `unist-util-is`-compatible test.
34-
* @returns {Node | null}
35-
* Child of `parent` or `null`.
34+
* @returns {Node | undefined}
35+
* Child of `parent` or `undefined`.
3636
*/
3737
// To do: next major: `undefined`.
3838
export function findAfter(parent, index, test) {
@@ -60,5 +60,5 @@ export function findAfter(parent, index, test) {
6060
}
6161
}
6262

63-
return null
63+
return undefined
6464
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ that passes `test`.
106106

107107
###### Returns
108108

109-
Child of `parent` ([`Node`][node]) or `null`.
109+
Child of `parent` ([`Node`][node]) or `undefined`.
110110

111111
## Types
112112

test.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ test('findAfter', async function (t) {
9191
await t.test(
9292
'should return the following node when without `test` (#1)',
9393
async function () {
94-
assert.strictEqual(findAfter(paragraph, 7), null)
94+
assert.strictEqual(findAfter(paragraph, 7), undefined)
9595
}
9696
)
9797

@@ -122,21 +122,24 @@ test('findAfter', async function (t) {
122122
await t.test(
123123
'should return `node` when given a `node` and existing (#4)',
124124
async function () {
125-
assert.strictEqual(findAfter(paragraph, children[0], children[0]), null)
125+
assert.strictEqual(
126+
findAfter(paragraph, children[0], children[0]),
127+
undefined
128+
)
126129
}
127130
)
128131

129132
await t.test(
130133
'should return `node` when given a `node` and existing (#5)',
131134
async function () {
132-
assert.strictEqual(findAfter(paragraph, 0, children[0]), null)
135+
assert.strictEqual(findAfter(paragraph, 0, children[0]), undefined)
133136
}
134137
)
135138

136139
await t.test(
137140
'should return `node` when given a `node` and existing (#6)',
138141
async function () {
139-
assert.strictEqual(findAfter(paragraph, 1, children[1]), null)
142+
assert.strictEqual(findAfter(paragraph, 1, children[1]), undefined)
140143
}
141144
)
142145

@@ -150,7 +153,7 @@ test('findAfter', async function (t) {
150153
await t.test(
151154
'should return a child when given a `type` and existing (#2)',
152155
async function () {
153-
assert.strictEqual(findAfter(paragraph, 3, 'strong'), null)
156+
assert.strictEqual(findAfter(paragraph, 3, 'strong'), undefined)
154157
}
155158
)
156159

@@ -167,7 +170,7 @@ test('findAfter', async function (t) {
167170
await t.test(
168171
'should return a child when given a `type` and existing (#4)',
169172
async function () {
170-
assert.strictEqual(findAfter(paragraph, children[3], 'strong'), null)
173+
assert.strictEqual(findAfter(paragraph, children[3], 'strong'), undefined)
171174
}
172175
)
173176

@@ -181,7 +184,7 @@ test('findAfter', async function (t) {
181184
await t.test(
182185
'should return a child when given a `test` and existing (#2)',
183186
async function () {
184-
assert.strictEqual(findAfter(paragraph, 5, check), null)
187+
assert.strictEqual(findAfter(paragraph, 5, check), undefined)
185188
}
186189
)
187190

@@ -195,7 +198,7 @@ test('findAfter', async function (t) {
195198
await t.test(
196199
'should return a child when given a `test` and existing (#4)',
197200
async function () {
198-
assert.strictEqual(findAfter(paragraph, children[6], check), null)
201+
assert.strictEqual(findAfter(paragraph, children[6], check), undefined)
199202
}
200203
)
201204
})

0 commit comments

Comments
 (0)