@danielhaim/titlecaser 1.2.57 → 1.2.59

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.
@@ -1,248 +1,152 @@
1
1
  export const commonAbbreviationList = [
2
- 'a', 'an', 'the', 'as', 'at', 'by', 'for', 'in', 'of', 'on',
3
- 'to', 'up', 'yet', 'so', 'but', 'nor', 'or', 'and',
2
+ "a",
3
+ "an",
4
+ "the",
5
+ "as",
6
+ "at",
7
+ "by",
8
+ "for",
9
+ "in",
10
+ "of",
11
+ "on",
12
+ "to",
13
+ "up",
14
+ "yet",
15
+ "so",
16
+ "but",
17
+ "nor",
18
+ "or",
19
+ "and",
4
20
  ];
5
21
 
6
- export const correctTitleCasingList = [
7
- // Web Technologies
8
- 'AJAX', 'CSS', 'DOM', 'ES6', 'HTML', 'JavaScript', 'jQuery',
9
- 'MobX', 'SCSS', 'TypeScript', 'Vue.js', '.NET', 'ASP', 'ASPX',
10
- 'MySQL', 'PHP', 'PostgresQL', 'Python', 'SQL', 'GraphQL',
11
- 'HTML5',
12
-
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
-
46
- // Acronyms/Abbreviations
47
- 'API', 'APIs', 'ASCII', 'CI', 'CircleCI', 'CLI', 'DLL', 'DNS',
48
- 'EC2', 'FTP', 'HTTP', 'HTTPs', 'ICMP', 'IDE', 'IP', 'ISP',
49
- 'JSON', 'JSP', 'LPWAN', 'M2M', 'MQTT', 'OOP', 'REST', 'SSH',
50
- 'SSL', 'TCP', 'UDP', 'URL', 'WLAN', 'WYSIWYG', 'XML', 'YAML',
51
- 'YML', 'IMAP', 'RSS', 'IaaS', 'PaaS', 'SaaS', 'CaaS', 'FaaS',
52
- 'XaaS', 'RaaS', 'IoE', 'IoT', 'LoRa', 'NB-IoT', 'RFID', 'RF',
53
- 'RFI', 'RFQ', 'ECMAScript', 'IO', 'I/O', 'DevOps', 'SecOps',
54
- 'DDoS', 'VoIP', 'AI', 'AR', 'ML', 'VR', 'CI/CD',
55
-
56
- // Misc.
57
- 'w/', 'w/o',
58
-
59
- // 'eTerms'
60
- 'e-Book', 'e-Books', 'eBook', 'eBooks', 'eCommerce',
61
- 'eMarket', 'eMarketplace', 'eMarketplaces', 'eMarkets',
62
- 'eReader', 'eShop', 'eShops', 'eStore', 'eStores',
63
- 'E-commerce',
64
-
65
- // Accounting terms
66
- 'AP', 'COGS', 'EBIT', 'EPS', 'FIFO', 'GAAP', 'LIFO',
67
- 'P&L', 'ROI', 'SOX', 'TCO', 'VAT',
68
-
69
- // Investment terms
70
- 'CAGR', 'DCF', 'ETF', 'IPO', 'IRR', 'M&A', 'NAV', 'PE', 'PEG',
71
- 'PPE', 'ROE', 'S&P', 'TVM', 'VC',
72
-
73
- // Marketing terms
74
- 'B2B', 'B2C', 'CMO', 'CPA', 'CPC', 'CPL', 'CPM', 'CRM', 'CTA',
75
- 'CTR', 'SEO', 'SEM', 'SMM', 'USP', 'A/B', 'CTA', 'CTOR',
76
- 'CTR', 'KPI', 'PWA', 'SEM', 'SERP', 'SERPs', 'SMM', 'SMO',
77
- 'FAQ', 'FAQs', 'UI', 'UI/UX', 'UX', 'T&C', 'TOS',
78
- 'PP', 'CRM', 'PoE', 'PoW', 'PoC', 'A11Y', 'PR',
79
-
80
- // Sales terms
81
- 'BANT', 'KPI', 'MQL', 'NPS', 'POS', 'SPIN', 'SQL',
82
- 'SWOT',
83
-
84
- // Legal terms
85
- 'AFA', 'ADR', 'CCPA', 'CFAA', 'CISG', 'DMCA', 'EULA', 'GDPR',
86
- 'HIPAA', 'NDA', 'SOW', 'TOS',
87
-
88
- // Roles and titles
89
- 'CEO', 'CEOs', 'CFO', 'CFOs', 'CIO', 'CIOs', 'CMO', 'CMOs',
90
- 'COO', 'COOs', 'CPO', 'CPOs', 'CRO', 'CROs', 'CSO', 'CSOs',
91
- 'CTO', 'CTOs', 'EVP', 'EVPs', 'HR', 'HRs', 'SVP', 'SVPs',
92
- 'VP', 'VPs',
93
-
94
- // Non-profit organizations
95
- 'NGO', 'NPO', 'NGOs', 'NPOs', 'UN', 'UNESCO', 'UNICEF',
96
- 'UNHCR', 'UNODC', 'UNDP', 'UNFPA', 'UNEP',
97
-
98
- 'Adobe', 'Airbnb', 'Alibaba', 'Allstate', 'American Express', 'Apple',
99
- 'AT&T', 'BMW', 'Boeing', 'Cisco', 'Citigroup', 'Coca', 'Deloitte', 'Disney',
100
- 'Dropbox', 'ExxonMobil', 'Ford', 'GE', 'General', 'Goldman Sachs', 'Google',
101
- 'Hilton', 'HP', 'IBM', 'Intel', 'JPMorgan', 'Johnson & Johnson', 'LinkedIn',
102
- "McDonald's", 'Mercedes-Benz', 'Microsoft', 'Nestle', 'Nike', 'Nissan',
103
- 'Oracle', 'PepsiCo', 'Pfizer', 'Salesforce', 'Samsung', 'Shell', 'Sony',
104
- 'Tesla', 'Toyota', 'Uber', 'Verizon', 'Visa', 'Walmart', 'Wells Fargo',
105
- 'Yahoo', 'Zara', 'IKEA', 'Facebook', 'YouTube', 'Instagram', 'Twitter',
106
- 'TensorFlow', 'Amazon', 'Netflix', 'eBay', 'iPhone', 'iPad', 'iPod',
107
- 'PlayStation', 'PayPal', 'GitHub', 'GitLab', 'CodeIgniter', 'WordPress',
108
- 'WooCommerce', 'MongoDB', 'JIRA', 'HubSpot', 'AirDrop', 'AirPlay', 'AirPods',
109
- 'AirTags', 'FinalCut', 'GarageBand', 'iBooks', 'iCloud', 'iLife', 'iMac',
110
- 'iMessage', 'iMovie', 'iPhoto', 'iWatch', 'iWork', 'LogicPro', 'macOS',
111
- 'ProTools', 'QuickTime', 'AdWords', 'AdSense', 'TikTok', 'Slack', 'Trello',
112
- 'Zoom', 'Twitch', 'Snapchat', 'WhatsApp', 'Telegram', 'Discord', 'Reddit',
113
- 'Quora', 'StackOverflow', 'StackExchange', 'Coca-Cola',
114
- 'AWS', 'GCP', 'VMware', 'CVS', 'ESL', 'EE', 'CW', 'EE', 'ITV',
115
-
116
- // Sports
117
- 'NBA', 'NCAA', 'NFL', 'WWE', 'WWF', 'FIFA',
118
-
119
- // Time-related, numbers, and measurements: Includes abbreviations for
120
- 'a.m.', 'p.m.', 'ca.', 'cc.', 'fig.', 'pl.', 'pt.', 'rev.',
121
- 'sr.', 'v.', 'vol.', 'et al.', 'pp.', 'p.',
122
-
123
- // Professional abbreviations, degrees, and titles: Includes abbreviations
124
- 'ph.d.', 'm.d.', 'd.d.s.', 'd.m.d.', 'd.o.', 'd.c.', 'd.v.m.',
125
- 'd.n.p.', 'd.p.m.', 'd.s.w.', 'd.s.n.', 'd.n.sc.', 'd.n.a.',
126
- 'd.n.t.', 'd.n.p.t.', 'd.n.o.', 'd.n.m.', 'd.n.e.', 'd.n.s.',
127
- 'd.n.p.s.',
128
-
129
- // Academic & literary abbreviations: Includes abbreviations for academic
130
- 'adj.', 'adv.', 'cf.', 'cm.', 'co.', 'corp.', 'dept.',
131
- 'dist.', 'ed.', 'edn.', 'esp.', 'etc.', 'ex.', 'i.e.', 'e.g.',
132
- 'op. cit.', 'vs.',
133
-
134
- // Commercial
135
- 'Ltd.', 'Co.', 'Inc.', 'St.', 'Ave.', 'Bldg.', 'No.',
136
-
137
- // Other
138
- '×', 'x', 'TV', 'IRL', 'UK'
139
- ];
22
+ import brandList from "./data/brandList.json";
23
+ import businessFinanceLegalTerms from "./data/businessFinanceLegalTerms.json";
24
+ import eCommerceDigitalTerms from "./data/eCommerceDigitalTerms.json";
25
+ import globalGeography from "./data/globalGeography.json";
26
+ import marketingMediaTerms from "./data/marketingMediaTerms.json";
27
+ import miscSpecializedTerms from "./data/miscSpecializedTerms.json";
28
+ import techComputingConcepts from "./data/techComputingConcepts.json";
29
+ import timeAcademicTerms from "./data/timeAcademicTerms.json";
30
+
31
+ function mergeArrays(...arraysOrObjects) {
32
+ const merged = [];
33
+
34
+ arraysOrObjects.forEach((item) => {
35
+ if (Array.isArray(item)) {
36
+ // If the item is an array, process each object in the array
37
+ item.forEach((obj) => {
38
+ Object.values(obj).forEach((value) => {
39
+ merged.push(...value);
40
+ });
41
+ });
42
+ } else if (typeof item === "object") {
43
+ // If the item is an object, directly take its values
44
+ Object.values(item).forEach((value) => {
45
+ merged.push(...value);
46
+ });
47
+ }
48
+ });
49
+
50
+ return [...new Set(merged)];
51
+ }
52
+
53
+ const mergedArray = mergeArrays(
54
+ brandList,
55
+ businessFinanceLegalTerms,
56
+ eCommerceDigitalTerms,
57
+ globalGeography,
58
+ marketingMediaTerms,
59
+ miscSpecializedTerms,
60
+ techComputingConcepts,
61
+ timeAcademicTerms,
62
+ );
63
+
64
+ export const correctTitleCasingList = mergedArray;
140
65
 
141
66
  export const wordReplacementsList = [
142
- { 'a.k.a': 'AKA' },
143
- { 'a.s.a.p': 'ASAP' },
144
- { 'angularjs': 'Angular.js' },
145
- { 'back-end': 'Backend' },
146
- { 'd.i.y': 'DIY' },
147
- { 'e-book': 'eBook' },
148
- { 'e-books': 'eBooks' },
149
- { 'e-commerce': 'eCommerce' },
150
- { 'ecom': 'eCommerce' },
151
- { 'ecommerce': 'eCommerce' },
152
- { 'f.a.q': 'FAQ' },
153
- { 'f.a.q.a': 'FAQs' },
154
- { 'f.a.q.s': 'FAQs' },
155
- { 'f.y.i': 'FYI' },
156
- { 'front-end': 'Frontend' },
157
- { 'full-stack': 'Fullstack' },
158
- { 'nextjs': 'Next.js' },
159
- { 'nodejs': 'Node.js' },
160
- { 'nuxtjs': 'Nuxt.js' },
161
- { 'reactjs': 'React.js' },
162
- { 't.b.d': 'TBD' },
163
- { 'vuejs': 'Vue.js' },
164
- { 'phd': 'ph.d.' },
165
- { 'x': '×' },
67
+ { "e-book": "eBook" },
68
+ { "e-books": "eBooks" },
69
+ { "e-commerce": "eCommerce" },
70
+ { ecom: "eCommerce" },
71
+ { ecommerce: "eCommerce" },
72
+ { "a.k.a": "AKA" },
73
+ { "a.s.a.p": "ASAP" },
74
+ { "f.a.q": "FAQ" },
75
+ { "f.a.q.a": "FAQs" },
76
+ { "f.a.q.s": "FAQs" },
77
+ { "f.y.i": "FYI" },
78
+ { "d.i.y": "DIY" },
79
+ { "t.b.d": "TBD" },
80
+ { phd: "Ph.D." },
81
+ { "back-end": "Backend" },
82
+ { "front-end": "Frontend" },
83
+ { "full-stack": "Fullstack" },
84
+ { angularjs: "Angular.js" },
85
+ { nextjs: "Next.js" },
86
+ { nodejs: "Node.js" },
87
+ { nuxtjs: "Nuxt.js" },
88
+ { reactjs: "React.js" },
89
+ { vuejs: "Vue.js" },
90
+ { "cyber-security": "Cybersecurity" },
91
+ { skoda: "Škoda" },
92
+ { mcdonalds: "McDonald's" },
93
+ { sainsburys: "Sainsbury's" },
94
+ { hersheys: "Hershey's" },
95
+ { kellogs: "Kellogg's" },
96
+ { dominos: "Domino's" },
166
97
  ];
167
98
 
168
- // ! TODO
169
- // const wordReplacementsList = [
170
- // { word: 'a.k.a', replacement: 'AKA' },
171
- // { word: 'a.s.a.p', replacement: 'ASAP' },
172
- // { word: 'angularjs', replacement: 'Angular.js' },
173
- // { word: 'back-end', replacement: 'Backend' },
174
- // { word: 'd.i.y', replacement: 'DIY' },
175
- // { word: 'e-book', replacement: 'eBook' },
176
- // { word: 'e-books', replacement: 'eBooks' },
177
- // { word: 'e-commerce', replacement: 'eCommerce' },
178
- // { word: 'ecom', replacement: 'eCommerce' },
179
- // { word: 'ecommerce', replacement: 'eCommerce' },
180
- // { word: 'f.a.q', replacement: 'FAQ' },
181
- // { word: 'f.a.q.a', replacement: 'FAQs' },
182
- // { word: 'f.a.q.s', replacement: 'FAQs' },
183
- // { word: 'f.y.i', replacement: 'FYI' },
184
- // { word: 'front-end', replacement: 'Frontend' },
185
- // { word: 'full-stack', replacement: 'Fullstack' },
186
- // { word: 'nextjs', replacement: 'Next.js' },
187
- // { word: 'nodejs', replacement: 'Node.js' },
188
- // { word: 'nuxtjs', replacement: 'Nuxt.js' },
189
- // { word: 'reactjs', replacement: 'React.js' },
190
- // { word: 't.b.d', replacement: 'TBD' },
191
- // { word: 'vuejs', replacement: 'Vue.js' },
192
- // { word: 'phd', replacement: 'ph.d.' },
193
- // ];
194
-
195
99
  export const titleCaseStylesList = Object.freeze({
196
- AP: 'ap',
197
- APA: 'apa',
198
- BRITISH: 'british',
199
- CHICAGO: 'chicago',
200
- NYT: 'nyt',
201
- WIKIPEDIA: 'wikipedia'
100
+ AP: "ap",
101
+ APA: "apa",
102
+ BRITISH: "british",
103
+ CHICAGO: "chicago",
104
+ NYT: "nyt",
105
+ WIKIPEDIA: "wikipedia",
202
106
  });
203
107
  export const allowedTitleCaseStylesList = Object.values(titleCaseStylesList);
204
108
  export const titleCaseDefaultOptionsList = Object.freeze({
205
- ap: {
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
- neverCapitalizedList: []
210
- },
211
- apa: {
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
- neverCapitalizedList: []
216
- },
217
- british: {
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
- neverCapitalizedList: []
222
- },
223
- chicago: {
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
- },
229
- nyt: {
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
- neverCapitalizedList: []
234
- },
235
- wikipedia: {
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
- neverCapitalizedList: []
240
- },
109
+ ap: {
110
+ shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
111
+ articlesList: ["a", "an", "the"],
112
+ shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
113
+ neverCapitalizedList: [],
114
+ },
115
+ apa: {
116
+ shortConjunctionsList: ["and", "as", "but", "by", "for", "in", "nor", "of", "on", "or", "so", "to", "yet"],
117
+ articlesList: ["a", "an", "the"],
118
+ shortPrepositionsList: ["as", "at", "by", "for", "in", "of", "on", "to", "up", "via"],
119
+ neverCapitalizedList: [],
120
+ },
121
+ british: {
122
+ shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
123
+ articlesList: ["a", "an", "the"],
124
+ shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
125
+ neverCapitalizedList: [],
126
+ },
127
+ chicago: {
128
+ shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
129
+ articlesList: ["a", "an", "the"],
130
+ shortPrepositionsList: ["as", "at", "by", "for", "in", "of", "on", "to", "up", "with", "via"],
131
+ neverCapitalizedList: ["etc."],
132
+ },
133
+ nyt: {
134
+ shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
135
+ articlesList: ["a", "an", "the"],
136
+ shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
137
+ neverCapitalizedList: [],
138
+ },
139
+ wikipedia: {
140
+ shortConjunctionsList: ["and", "as", "but", "for", "if", "nor", "or", "so", "yet"],
141
+ articlesList: ["a", "an", "the"],
142
+ shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
143
+ neverCapitalizedList: [],
144
+ },
241
145
  });
242
146
 
243
147
  export const ignoredWordList = [];
244
- export const correctPhraseCasingList = [
245
- 'The Cybersmile Foundation',
246
- 'CO. by Colgate',
247
- "The Simpsons",
248
- ];
148
+ export const correctPhraseCasingList = {
149
+ 'the cybersmile foundation': 'The Cybersmile Foundation',
150
+ 'co. by colgate': 'CO. by Colgate'
151
+ };
152
+