Skip to content

Commit 6854a92

Browse files
author
sanscontext
committed
sort categories too
1 parent ba285cb commit 6854a92

File tree

3 files changed

+73
-66
lines changed

3 files changed

+73
-66
lines changed

scripts/papi.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const updateSources = async () => {
275275
mainCategory = 'cloud-app'
276276
}
277277

278-
// sort the sources alphabetically
278+
// sort the sources alphabetically. JS's default sort is case sensistve which is why we compare lowercase on the fly
279279
settings.sort((a, b) => {
280280
if(a.name.toLowerCase() < b.name.toLowerCase()) { return -1; }
281281
if(a.name.toLowerCase() > b.name.toLowerCase()) { return 1; }
@@ -316,6 +316,11 @@ const updateSources = async () => {
316316
display_name: category,
317317
slug: slugify(category)
318318
})
319+
sourceCategories.sort((a, b) => {
320+
if(a.display_name.toLowerCase() < b.display_name.toLowerCase()) { return -1; }
321+
if(a.display_name.toLowerCase() > b.display_name.toLowerCase()) { return 1; }
322+
return 0;
323+
})
319324
})
320325

321326

@@ -413,16 +418,18 @@ const updateDestinations = async () => {
413418
})
414419

415420

416-
417-
const destinationArray = Array.from(categories)
418-
419-
420-
destinationArray.forEach(category => {
421-
destinationCategories.push({
422-
display_name: category,
423-
slug: slugify(category)
424-
})
421+
const destinationArray = Array.from(categories)
422+
destinationArray.forEach(category => {
423+
destinationCategories.push({
424+
display_name: category,
425+
slug: slugify(category)
425426
})
427+
destinationCategories.sort((a, b) => {
428+
if(a.display_name.toLowerCase() < b.display_name.toLowerCase()) { return -1; }
429+
if(a.display_name.toLowerCase() > b.display_name.toLowerCase()) { return 1; }
430+
return 0;
431+
})
432+
})
426433

427434

428435
const options = { noArrayIndent: true };
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT
22
# destination categories last updated 2021-06-30
33
items:
4-
- display_name: Email Marketing
5-
slug: email-marketing
4+
- display_name: A/B Testing
5+
slug: a-b-testing
66
- display_name: Advertising
77
slug: advertising
8+
- display_name: Analytics
9+
slug: analytics
810
- display_name: Attribution
911
slug: attribution
12+
- display_name: CRM
13+
slug: crm
14+
- display_name: Customer Success
15+
slug: customer-success
1016
- display_name: Deep Linking
1117
slug: deep-linking
12-
- display_name: Analytics
13-
slug: analytics
18+
- display_name: Email
19+
slug: email
20+
- display_name: Email Marketing
21+
slug: email-marketing
1422
- display_name: Enrichment
1523
slug: enrichment
16-
- display_name: A/B Testing
17-
slug: a-b-testing
18-
- display_name: Video
19-
slug: video
20-
- display_name: Customer Success
21-
slug: customer-success
22-
- display_name: Performance Monitoring
23-
slug: performance-monitoring
24-
- display_name: SMS & Push Notifications
25-
slug: sms-push-notifications
24+
- display_name: Feature Flagging
25+
slug: feature-flagging
26+
- display_name: Heatmaps & Recordings
27+
slug: heatmaps-recordings
28+
- display_name: Livechat
29+
slug: livechat
2630
- display_name: Marketing Automation
2731
slug: marketing-automation
32+
- display_name: Performance Monitoring
33+
slug: performance-monitoring
2834
- display_name: Personalization
2935
slug: personalization
3036
- display_name: Raw Data
3137
slug: raw-data
3238
- display_name: Referrals
3339
slug: referrals
34-
- display_name: Feature Flagging
35-
slug: feature-flagging
36-
- display_name: Heatmaps & Recordings
37-
slug: heatmaps-recordings
38-
- display_name: Surveys
39-
slug: surveys
40-
- display_name: CRM
41-
slug: crm
4240
- display_name: Security & Fraud
4341
slug: security-fraud
44-
- display_name: Livechat
45-
slug: livechat
42+
- display_name: SMS & Push Notifications
43+
slug: sms-push-notifications
44+
- display_name: Surveys
45+
slug: surveys
4646
- display_name: Tag Managers
4747
slug: tag-managers
48-
- display_name: Email
49-
slug: email
48+
- display_name: Video
49+
slug: video
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT
22
# source cateogries last updated 2021-06-30
33
items:
4-
- display_name: Server
5-
slug: server
6-
- display_name: Email Marketing
7-
slug: email-marketing
4+
- display_name: A/B Testing
5+
slug: a-b-testing
6+
- display_name: Advertising
7+
slug: advertising
8+
- display_name: Analytics
9+
slug: analytics
810
- display_name: CRM
911
slug: crm
10-
- display_name: Helpdesk
11-
slug: helpdesk
12+
- display_name: Custom
13+
slug: custom
1214
- display_name: Customer Success
1315
slug: customer-success
16+
- display_name: Email Marketing
17+
slug: email-marketing
18+
- display_name: Enrichment
19+
slug: enrichment
20+
- display_name: Feature Flagging
21+
slug: feature-flagging
22+
- display_name: Helpdesk
23+
slug: helpdesk
24+
- display_name: Livechat
25+
slug: livechat
1426
- display_name: Marketing Automation
1527
slug: marketing-automation
16-
- display_name: SMS & Push Notifications
17-
slug: sms-push-notifications
18-
- display_name: Custom
19-
slug: custom
2028
- display_name: Mobile
2129
slug: mobile
22-
- display_name: Analytics
23-
slug: analytics
24-
- display_name: Surveys
25-
slug: surveys
30+
- display_name: Ott
31+
slug: ott
32+
- display_name: Payments
33+
slug: payments
34+
- display_name: Performance Monitoring
35+
slug: performance-monitoring
2636
- display_name: Personalization
2737
slug: personalization
28-
- display_name: Livechat
29-
slug: livechat
30-
- display_name: Advertising
31-
slug: advertising
32-
- display_name: Enrichment
33-
slug: enrichment
3438
- display_name: Referrals
3539
slug: referrals
40+
- display_name: Server
41+
slug: server
42+
- display_name: SMS & Push Notifications
43+
slug: sms-push-notifications
44+
- display_name: Surveys
45+
slug: surveys
3646
- display_name: Website
3747
slug: website
38-
- display_name: Feature Flagging
39-
slug: feature-flagging
40-
- display_name: A/B Testing
41-
slug: a-b-testing
42-
- display_name: Performance Monitoring
43-
slug: performance-monitoring
44-
- display_name: Ott
45-
slug: ott
46-
- display_name: Payments
47-
slug: payments

0 commit comments

Comments
 (0)