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