@danielhaim/titlecaser 1.2.53 → 1.2.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -7
- package/package.json +1 -1
- package/src/TitleCaser.js +122 -116
- package/src/TitleCaserConsts.js +71 -71
- package/src/TitleCaserUtils.js +318 -282
package/src/TitleCaserConsts.js
CHANGED
|
@@ -10,38 +10,38 @@ export const correctTitleCasingList = [
|
|
|
10
10
|
'MySQL', 'PHP', 'PostgresQL', 'Python', 'SQL', 'GraphQL',
|
|
11
11
|
'HTML5',
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
13
|
+
// Countries
|
|
14
|
+
'Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua and Barbuda',
|
|
15
|
+
'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas',
|
|
16
|
+
'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin',
|
|
17
|
+
'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Brazil', 'Brunei',
|
|
18
|
+
'Bulgaria', 'Burkina Faso', 'Burundi', 'Cabo Verde', 'Cambodia', 'Cameroon',
|
|
19
|
+
'Canada', 'Central African Republic', 'Chad', 'Chile', 'China', 'Colombia',
|
|
20
|
+
'Comoros', 'Congo', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia', 'Cuba',
|
|
21
|
+
'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti', 'Dominica',
|
|
22
|
+
'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea',
|
|
23
|
+
'Eritrea', 'Estonia', 'Eswatini', 'Ethiopia', 'Fiji', 'Finland', 'France',
|
|
24
|
+
'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Greece', 'Grenada',
|
|
25
|
+
'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 'Hungary',
|
|
26
|
+
'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy',
|
|
27
|
+
'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Korea',
|
|
28
|
+
'Kosovo', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho',
|
|
29
|
+
'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Madagascar',
|
|
30
|
+
'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands',
|
|
31
|
+
'Mauritania', 'Mauritius', 'Mexico', 'Micronesia', 'Moldova', 'Monaco',
|
|
32
|
+
'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia',
|
|
33
|
+
'Nauru', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria',
|
|
34
|
+
'North Macedonia', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Panama', 'Papua New Guinea',
|
|
35
|
+
'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Qatar', 'Romania',
|
|
36
|
+
'Russia', 'Rwanda', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines',
|
|
37
|
+
'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia',
|
|
38
|
+
'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands',
|
|
39
|
+
'Somalia', 'South Africa', 'South Korea', 'South Sudan', 'Spain', 'Sri Lanka', 'Sudan',
|
|
40
|
+
'Suriname', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania',
|
|
41
|
+
'Thailand', 'Timor-Leste', 'Togo', 'Tonga', 'Trinidad and Tobago', 'Tunisia',
|
|
42
|
+
'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates',
|
|
43
|
+
'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City',
|
|
44
|
+
'Venezuela', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe',
|
|
45
45
|
|
|
46
46
|
// Acronyms/Abbreviations
|
|
47
47
|
'API', 'APIs', 'ASCII', 'CI', 'CircleCI', 'CLI', 'DLL', 'DNS',
|
|
@@ -52,49 +52,49 @@ export const correctTitleCasingList = [
|
|
|
52
52
|
'XaaS', 'RaaS', 'IoE', 'IoT', 'LoRa', 'NB-IoT', 'RFID', 'RF',
|
|
53
53
|
'RFI', 'RFQ', 'ECMAScript', 'IO', 'I/O', 'DevOps', 'SecOps',
|
|
54
54
|
'DDoS', 'VoIP', 'AI', 'AR', 'ML', 'VR', 'CI/CD',
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
// Misc.
|
|
57
57
|
'w/', 'w/o',
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
// 'eTerms'
|
|
60
60
|
'e-Book', 'e-Books', 'eBook', 'eBooks', 'eCommerce',
|
|
61
61
|
'eMarket', 'eMarketplace', 'eMarketplaces', 'eMarkets',
|
|
62
62
|
'eReader', 'eShop', 'eShops', 'eStore', 'eStores',
|
|
63
63
|
'E-commerce',
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
// Accounting terms
|
|
66
66
|
'AP', 'COGS', 'EBIT', 'EPS', 'FIFO', 'GAAP', 'LIFO',
|
|
67
67
|
'P&L', 'ROI', 'SOX', 'TCO', 'VAT',
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
// Investment terms
|
|
70
70
|
'CAGR', 'DCF', 'ETF', 'IPO', 'IRR', 'M&A', 'NAV', 'PE', 'PEG',
|
|
71
71
|
'PPE', 'ROE', 'S&P', 'TVM', 'VC',
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
// Marketing terms
|
|
74
74
|
'B2B', 'B2C', 'CMO', 'CPA', 'CPC', 'CPL', 'CPM', 'CRM', 'CTA',
|
|
75
75
|
'CTR', 'SEO', 'SEM', 'SMM', 'USP', 'A/B', 'CTA', 'CTOR',
|
|
76
76
|
'CTR', 'KPI', 'PWA', 'SEM', 'SERP', 'SERPs', 'SMM', 'SMO',
|
|
77
77
|
'FAQ', 'FAQs', 'UI', 'UI/UX', 'UX', 'T&C', 'TOS',
|
|
78
78
|
'PP', 'CRM', 'PoE', 'PoW', 'PoC', 'A11Y', 'PR',
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
// Sales terms
|
|
81
81
|
'BANT', 'KPI', 'MQL', 'NPS', 'POS', 'SPIN', 'SQL',
|
|
82
82
|
'SWOT',
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
// Legal terms
|
|
85
85
|
'AFA', 'ADR', 'CCPA', 'CFAA', 'CISG', 'DMCA', 'EULA', 'GDPR',
|
|
86
86
|
'HIPAA', 'NDA', 'SOW', 'TOS',
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
// Roles and titles
|
|
89
89
|
'CEO', 'CEOs', 'CFO', 'CFOs', 'CIO', 'CIOs', 'CMO', 'CMOs',
|
|
90
90
|
'COO', 'COOs', 'CPO', 'CPOs', 'CRO', 'CROs', 'CSO', 'CSOs',
|
|
91
91
|
'CTO', 'CTOs', 'EVP', 'EVPs', 'HR', 'HRs', 'SVP', 'SVPs',
|
|
92
92
|
'VP', 'VPs',
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
// Non-profit organizations
|
|
95
95
|
'NGO', 'NPO', 'NGOs', 'NPOs', 'UN', 'UNESCO', 'UNICEF',
|
|
96
96
|
'UNHCR', 'UNODC', 'UNDP', 'UNFPA', 'UNEP',
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
'Adobe', 'Airbnb', 'Alibaba', 'Allstate', 'American Express', 'Apple',
|
|
99
99
|
'AT&T', 'BMW', 'Boeing', 'Cisco', 'Citigroup', 'Coca', 'Deloitte', 'Disney',
|
|
100
100
|
'Dropbox', 'ExxonMobil', 'Ford', 'GE', 'General', 'Goldman Sachs', 'Google',
|
|
@@ -112,25 +112,25 @@ export const correctTitleCasingList = [
|
|
|
112
112
|
'Zoom', 'Twitch', 'Snapchat', 'WhatsApp', 'Telegram', 'Discord', 'Reddit',
|
|
113
113
|
'Quora', 'StackOverflow', 'StackExchange', 'Coca-Cola',
|
|
114
114
|
'AWS', 'GCP', 'VMware', 'CVS', 'ESL', 'EE', 'CW', 'EE', 'ITV',
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
// Sports
|
|
117
117
|
'NBA', 'NCAA', 'NFL', 'WWE', 'WWF', 'FIFA',
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
// Time-related, numbers, and measurements: Includes abbreviations for
|
|
120
120
|
'a.m.', 'p.m.', 'ca.', 'cc.', 'fig.', 'pl.', 'pt.', 'rev.',
|
|
121
121
|
'sr.', 'v.', 'vol.', 'et al.', 'pp.', 'p.',
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
// Professional abbreviations, degrees, and titles: Includes abbreviations
|
|
124
124
|
'ph.d.', 'm.d.', 'd.d.s.', 'd.m.d.', 'd.o.', 'd.c.', 'd.v.m.',
|
|
125
125
|
'd.n.p.', 'd.p.m.', 'd.s.w.', 'd.s.n.', 'd.n.sc.', 'd.n.a.',
|
|
126
126
|
'd.n.t.', 'd.n.p.t.', 'd.n.o.', 'd.n.m.', 'd.n.e.', 'd.n.s.',
|
|
127
127
|
'd.n.p.s.',
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
// Academic & literary abbreviations: Includes abbreviations for academic
|
|
130
130
|
'adj.', 'adv.', 'cf.', 'cm.', 'co.', 'corp.', 'dept.',
|
|
131
131
|
'dist.', 'ed.', 'edn.', 'esp.', 'etc.', 'ex.', 'i.e.', 'e.g.',
|
|
132
132
|
'op. cit.', 'vs.',
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
// Commercial
|
|
135
135
|
'Ltd.', 'Co.', 'Inc.', 'St.', 'Ave.', 'Bldg.', 'No.',
|
|
136
136
|
|
|
@@ -192,53 +192,53 @@ export const wordReplacementsList = [
|
|
|
192
192
|
// { word: 'phd', replacement: 'ph.d.' },
|
|
193
193
|
// ];
|
|
194
194
|
|
|
195
|
-
export const titleCaseStylesList = Object.freeze
|
|
195
|
+
export const titleCaseStylesList = Object.freeze({
|
|
196
196
|
AP: 'ap',
|
|
197
197
|
APA: 'apa',
|
|
198
198
|
BRITISH: 'british',
|
|
199
199
|
CHICAGO: 'chicago',
|
|
200
200
|
NYT: 'nyt',
|
|
201
201
|
WIKIPEDIA: 'wikipedia'
|
|
202
|
-
}
|
|
203
|
-
export const allowedTitleCaseStylesList = Object.values
|
|
204
|
-
export const titleCaseDefaultOptionsList = Object.freeze
|
|
202
|
+
});
|
|
203
|
+
export const allowedTitleCaseStylesList = Object.values(titleCaseStylesList);
|
|
204
|
+
export const titleCaseDefaultOptionsList = Object.freeze({
|
|
205
205
|
ap: {
|
|
206
|
-
shortConjunctionsList: [
|
|
207
|
-
articlesList: [
|
|
208
|
-
shortPrepositionsList: [
|
|
206
|
+
shortConjunctionsList: ['and', 'but', 'or', 'for', 'nor', 'yet', 'so'],
|
|
207
|
+
articlesList: ['a', 'an', 'the'],
|
|
208
|
+
shortPrepositionsList: ['as', 'at', 'by', 'in', 'of', 'on', 'to', 'up', 'via'],
|
|
209
209
|
neverCapitalizedList: []
|
|
210
210
|
},
|
|
211
211
|
apa: {
|
|
212
|
-
shortConjunctionsList: [
|
|
213
|
-
articlesList: [
|
|
214
|
-
shortPrepositionsList: [
|
|
212
|
+
shortConjunctionsList: ['and', 'as', 'but', 'by', 'for', 'in', 'nor', 'of', 'on', 'or', 'so', 'to', 'yet'],
|
|
213
|
+
articlesList: ['a', 'an', 'the'],
|
|
214
|
+
shortPrepositionsList: ['as', 'at', 'by', 'for', 'in', 'of', 'on', 'to', 'up', 'via'],
|
|
215
215
|
neverCapitalizedList: []
|
|
216
216
|
},
|
|
217
217
|
british: {
|
|
218
|
-
shortConjunctionsList: [
|
|
219
|
-
articlesList: [
|
|
220
|
-
shortPrepositionsList: [
|
|
218
|
+
shortConjunctionsList: ['and', 'but', 'or', 'for', 'nor', 'yet', 'so'],
|
|
219
|
+
articlesList: ['a', 'an', 'the'],
|
|
220
|
+
shortPrepositionsList: ['as', 'at', 'by', 'in', 'of', 'on', 'to', 'up', 'via'],
|
|
221
221
|
neverCapitalizedList: []
|
|
222
222
|
},
|
|
223
223
|
chicago: {
|
|
224
|
-
shortConjunctionsList: [
|
|
225
|
-
articlesList: [
|
|
226
|
-
shortPrepositionsList: [
|
|
227
|
-
neverCapitalizedList: [
|
|
224
|
+
shortConjunctionsList: ['and', 'but', 'or', 'for', 'nor', 'yet', 'so'],
|
|
225
|
+
articlesList: ['a', 'an', 'the'],
|
|
226
|
+
shortPrepositionsList: ['as', 'at', 'by', 'for', 'in', 'of', 'on', 'to', 'up', 'with', 'via'],
|
|
227
|
+
neverCapitalizedList: ['etc.']
|
|
228
228
|
},
|
|
229
229
|
nyt: {
|
|
230
|
-
shortConjunctionsList: [
|
|
231
|
-
articlesList: [
|
|
232
|
-
shortPrepositionsList: [
|
|
230
|
+
shortConjunctionsList: ['and', 'but', 'or', 'for', 'nor', 'yet', 'so'],
|
|
231
|
+
articlesList: ['a', 'an', 'the'],
|
|
232
|
+
shortPrepositionsList: ['as', 'at', 'by', 'in', 'of', 'on', 'to', 'up', 'via'],
|
|
233
233
|
neverCapitalizedList: []
|
|
234
234
|
},
|
|
235
235
|
wikipedia: {
|
|
236
|
-
shortConjunctionsList: [
|
|
237
|
-
articlesList: [
|
|
238
|
-
shortPrepositionsList: [
|
|
236
|
+
shortConjunctionsList: ['and', 'as', 'but', 'for', 'if', 'nor', 'or', 'so', 'yet'],
|
|
237
|
+
articlesList: ['a', 'an', 'the'],
|
|
238
|
+
shortPrepositionsList: ['as', 'at', 'by', 'in', 'of', 'on', 'to', 'up', 'via'],
|
|
239
239
|
neverCapitalizedList: []
|
|
240
240
|
},
|
|
241
|
-
}
|
|
241
|
+
});
|
|
242
242
|
|
|
243
243
|
export const ignoredWordList = [];
|
|
244
244
|
export const correctPhraseCasingList = [
|