Skip to content

Commit a5afc2b

Browse files
committed
Fix name of type
1 parent e77fa1e commit a5afc2b

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
* @typedef {import('./lib/index.js').Options} Options
44
* @typedef {import('./lib/index.js').TestFunction} TestFunction
55
* @typedef {import('./lib/index.js').Test} Test
6-
* @typedef {import('./lib/index.js').ZoneInfo} ZoneInfo
6+
* @typedef {import('./lib/index.js').Info} Info
7+
*/
8+
9+
// To do: next major: remove.
10+
/**
11+
* @typedef {Info} ZoneInfo
12+
* Deprecated: use `Info`
713
*/
814

915
export {headingRange} from './lib/index.js'

lib/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @property {boolean | null | undefined} [ignoreFinalDefinitions=false]
3434
* Ignore final definitions otherwise in the section.
3535
*
36-
* @typedef ZoneInfo
36+
* @typedef Info
3737
* Extra info.
3838
* @property {Parent} parent
3939
* Parent of the section.
@@ -50,7 +50,7 @@
5050
* Nodes between `start` and `end`.
5151
* @param {Node | undefined} end
5252
* End of section, if any.
53-
* @param {ZoneInfo} scope
53+
* @param {Info} scope
5454
* Extra info.
5555
* @returns {Array<Node | null | undefined> | null | undefined | void}
5656
* Results.
@@ -62,6 +62,10 @@
6262

6363
import {toString} from 'mdast-util-to-string'
6464

65+
// To do: next major: remove `null` in API output.
66+
// To do: next major: remove `value` parameter in `TestFunction`?
67+
// Add support for `unist-util-is`?
68+
6569
/**
6670
* Search `tree` for a heading matching `test` and change its “section” with
6771
* `handler`.

readme.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
* [API](#api)
2020
* [`headingRange(tree, test|options, handler)`](#headingrangetree-testoptions-handler)
2121
* [`Handler`](#handler)
22+
* [`Info`](#info)
2223
* [`Options`](#options)
2324
* [`Test`](#test)
2425
* [`TestFunction`](#testfunction)
25-
* [`ZoneInfo`](#zoneinfo)
2626
* [Types](#types)
2727
* [Compatibility](#compatibility)
2828
* [Security](#security)
@@ -160,9 +160,22 @@ Callback called when a section is found (TypeScript type).
160160
— nodes between `start` and `end`
161161
* `end` ([`Node`][node] or `undefined`)
162162
— end of section, if any
163-
* `info` ([`ZoneInfo`][api-zoneinfo])
163+
* `info` ([`Info`][api-info])
164164
— extra info
165165

166+
### `Info`
167+
168+
Extra info (TypeScript type).
169+
170+
###### Fields
171+
172+
* `parent` ([`Node`][node])
173+
— parent of the section
174+
* `start` (`number`)
175+
— index of `start` in `parent`
176+
* `end` (`number` or `null`)
177+
— index of `end` in `parent`
178+
166179
###### Returns
167180

168181
Results (`Array<Node | null | undefined>`, optional).
@@ -210,25 +223,12 @@ Check if a node matches (TypeScript type).
210223
211224
Whether this is the heading that is searched for (`boolean`, optional).
212225
213-
### `ZoneInfo`
214-
215-
Extra info (TypeScript type).
216-
217-
###### Fields
218-
219-
* `parent` ([`Node`][node])
220-
— parent of the section
221-
* `start` (`number`)
222-
— index of `start` in `parent`
223-
* `end` (`number` or `null`)
224-
— index of `end` in `parent`
225-
226226
## Types
227227
228228
This package is fully typed with [TypeScript][].
229229
This package exports the types [`Handler`][api-handler],
230-
[`Options`][api-options], [`Test`][api-test],
231-
[`TestFunction`][api-testfunction], and [`ZoneInfo`][api-zoneinfo].
230+
[`Info`][api-info], [`Options`][api-options], [`Test`][api-test],
231+
and [`TestFunction`][api-testfunction].
232232
233233
## Compatibility
234234
@@ -358,4 +358,4 @@ abide by its terms.
358358

359359
[api-testfunction]: #testfunction
360360

361-
[api-zoneinfo]: #zoneinfo
361+
[api-info]: #info

0 commit comments

Comments
 (0)