File tree 3 files changed +8
-8
lines changed
3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 8
8
* Get a definition by identifier.
9
9
* @param {string | null | undefined } [identifier]
10
10
* Identifier of definition (optional).
11
- * @returns {Definition | null }
11
+ * @returns {Definition | undefined }
12
12
* Definition corresponding to `identifier` or `null`.
13
13
*/
14
14
@@ -48,7 +48,7 @@ export function definitions(tree) {
48
48
function definition ( identifier ) {
49
49
const id = clean ( identifier )
50
50
// To do: next major: return `undefined` when not found.
51
- return id && own . call ( cache , id ) ? cache [ id ] : null
51
+ return id && own . call ( cache , id ) ? cache [ id ] : undefined
52
52
}
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ definition('example')
73
73
// => {type: 'definition', 'title': 'Example', …}
74
74
75
75
definition (' foo' )
76
- // => null
76
+ // => undefined
77
77
```
78
78
79
79
## API
@@ -109,7 +109,7 @@ Get a definition by identifier (TypeScript type).
109
109
###### Returns
110
110
111
111
Definition corresponding to ` identifier ` ([ ` Definition ` ] [ definition ] ) or
112
- ` null ` .
112
+ ` undefined ` .
113
113
114
114
## Types
115
115
Original file line number Diff line number Diff line change @@ -38,10 +38,10 @@ test('definitions', async function (t) {
38
38
)
39
39
} )
40
40
41
- await t . test ( 'should return null when not found' , async function ( ) {
41
+ await t . test ( 'should return `undefined` when not found' , async function ( ) {
42
42
assert . equal (
43
43
definitions ( from ( '[example]: https://example.com "Example"' ) ) ( 'foo' ) ,
44
- null
44
+ undefined
45
45
)
46
46
} )
47
47
@@ -75,7 +75,7 @@ test('definitions', async function (t) {
75
75
async function ( ) {
76
76
assert . deepEqual (
77
77
definitions ( from ( '[__proto__]: https://proto.com "Proto"' ) ) ( 'toString' ) ,
78
- null
78
+ undefined
79
79
)
80
80
}
81
81
)
@@ -98,7 +98,7 @@ test('definitions', async function (t) {
98
98
definitions (
99
99
from ( '[example]: https://one.com\n[example]: https://two.com' )
100
100
) ( '' ) ,
101
- null
101
+ undefined
102
102
)
103
103
}
104
104
)
You can’t perform that action at this time.
0 commit comments