Skip to content

Commit 5a639da

Browse files
Regen for commit ee95d8d (#1656)
Signed-off-by: GitHub <noreply@github.com> Co-authored-by: davsclaus <davsclaus@users.noreply.github.com>
1 parent 9831f5f commit 5a639da

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

antora-ui-camel/public/_/helpers/order_components.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
'use strict'
22

3+
const order = [
4+
'manual',
5+
'camel-core',
6+
'components',
7+
'camel-spring-boot',
8+
'camel-quarkus',
9+
]
10+
311
module.exports = (components) =>
412
Object.entries(components)
513
.sort((a, b) => {
6-
const nameA = a[0]
7-
const nameB = b[0]
8-
9-
if (nameA === 'manual') {
10-
return -1
11-
}
12-
if (nameB === 'manual') {
13-
return 1
14-
}
15-
16-
if (nameA === 'components') {
17-
return -1
18-
}
19-
if (nameB === 'components') {
20-
return 1
21-
}
22-
23-
return nameA.localeCompare(nameB)
14+
const idxA = order.indexOf(a[0])
15+
const idxB = order.indexOf(b[0])
16+
if (idxA !== -1 && idxB !== -1) return idxA - idxB
17+
if (idxA !== -1) return -1
18+
if (idxB !== -1) return 1
19+
return a[0].localeCompare(b[0])
2420
})
2521
.reduce((obj, [k, v]) => {
2622
obj[k] = v

0 commit comments

Comments
 (0)