@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.
- package/README.md +52 -29
- package/package.json +3 -3
- package/src/TitleCaser.js +341 -231
- package/src/TitleCaserConsts.js +138 -234
- package/src/TitleCaserUtils.js +830 -601
- package/src/data/brandList.json +118 -0
- package/src/data/businessFinanceLegalTerms.json +28 -0
- package/src/data/eCommerceDigitalTerms.json +7 -0
- package/src/data/globalGeography.json +49 -0
- package/src/data/marketingMediaTerms.json +19 -0
- package/src/data/miscSpecializedTerms.json +6 -0
- package/src/data/techComputingConcepts.json +36 -0
- package/src/data/timeAcademicTerms.json +10 -0
package/src/TitleCaserConsts.js
CHANGED
|
@@ -1,248 +1,152 @@
|
|
|
1
1
|
export const commonAbbreviationList = [
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
148
|
+
export const correctPhraseCasingList = {
|
|
149
|
+
'the cybersmile foundation': 'The Cybersmile Foundation',
|
|
150
|
+
'co. by colgate': 'CO. by Colgate'
|
|
151
|
+
};
|
|
152
|
+
|