Skip to content

Commit e84a7b3

Browse files
committed
Order the README API reference Address4, Address6, AddressError
Source order put the error type first, which is not what a reader opening the reference is looking for.
1 parent 015160b commit e84a7b3

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ A few terms used throughout the API can be confusing if you haven't worked deepl
9898

9999
<!-- API:START -->
100100

101-
<details>
102-
<summary><a id="addresserror"></a><strong>AddressError</strong></summary>
103-
104-
**Constructor**
105-
106-
- `new AddressError(message: string, parseMessage?: string): AddressError`
107-
108-
**Properties**
109-
110-
- `parseMessage: string`[src](https://github.com/beaugunderson/ip-address/blob/master/src/address-error.ts#L2)
111-
112-
</details>
113-
114101
<details>
115102
<summary><a id="address4"></a><strong>Address4</strong> — Represents an IPv4 address</summary>
116103

@@ -273,6 +260,19 @@ A few terms used throughout the API can be confusing if you haven't worked deepl
273260

274261
</details>
275262

263+
<details>
264+
<summary><a id="addresserror"></a><strong>AddressError</strong></summary>
265+
266+
**Constructor**
267+
268+
- `new AddressError(message: string, parseMessage?: string): AddressError`
269+
270+
**Properties**
271+
272+
- `parseMessage: string`[src](https://github.com/beaugunderson/ip-address/blob/master/src/address-error.ts#L2)
273+
274+
</details>
275+
276276
<!-- API:END -->
277277

278278
### Used by

scripts/build-readme.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ function renderProperty(prop: TypeDoc.DeclarationReflection): string {
7676
return `- ${code}${tail ? ' — ' + tail : ''}`;
7777
}
7878

79+
const CLASS_ORDER = ['Address4', 'Address6', 'AddressError'];
80+
7981
function escapeHtml(text: string): string {
8082
return text
8183
.replace(/&/g, '&amp;')
@@ -195,9 +197,9 @@ async function main() {
195197
const project = await app.convert();
196198
if (!project) throw new Error('TypeDoc failed to convert the project');
197199

198-
const classes = (project.children ?? []).filter(
199-
(c) => c.kind === TypeDoc.ReflectionKind.Class,
200-
);
200+
const classes = (project.children ?? [])
201+
.filter((c) => c.kind === TypeDoc.ReflectionKind.Class)
202+
.sort((a, b) => CLASS_ORDER.indexOf(a.name) - CLASS_ORDER.indexOf(b.name));
201203

202204
const sections: string[] = [];
203205
for (const cls of classes) {

0 commit comments

Comments
 (0)