@danielhaim/titlecaser 1.7.0 → 1.7.2
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 +231 -87
- package/dist/titlecaser.amd.js +5 -0
- package/dist/titlecaser.module.js +5 -0
- package/index.d.ts +23 -0
- package/package.json +16 -14
- package/src/TitleCaser.js +120 -53
- package/src/TitleCaserConsts.js +188 -33
- package/src/TitleCaserUtils.js +166 -202
- package/src/data/brandList.json +532 -89
- package/src/data/businessFinanceLegalTerms.json +108 -14
- package/src/data/eCommerceDigitalTerms.json +13 -3
- package/src/data/globalGeography.json +197 -41
- package/src/data/marketingMediaTerms.json +37 -6
- package/src/data/militaryTerms.json +153 -0
- package/src/data/miscSpecializedTerms.json +12 -3
- package/src/data/techComputingConcepts.json +184 -26
- package/src/data/timeAcademicTerms.json +32 -5
package/src/TitleCaserConsts.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
export const commonAbbreviationList = [
|
|
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",
|
|
20
|
-
];
|
|
21
|
-
|
|
22
1
|
import brandList from "./data/brandList.json";
|
|
23
2
|
import businessFinanceLegalTerms from "./data/businessFinanceLegalTerms.json";
|
|
24
3
|
import eCommerceDigitalTerms from "./data/eCommerceDigitalTerms.json";
|
|
@@ -27,6 +6,7 @@ import marketingMediaTerms from "./data/marketingMediaTerms.json";
|
|
|
27
6
|
import miscSpecializedTerms from "./data/miscSpecializedTerms.json";
|
|
28
7
|
import techComputingConcepts from "./data/techComputingConcepts.json";
|
|
29
8
|
import timeAcademicTerms from "./data/timeAcademicTerms.json";
|
|
9
|
+
import militaryTerms from "./data/militaryTerms.json";
|
|
30
10
|
|
|
31
11
|
function mergeArrays(...arraysOrObjects) {
|
|
32
12
|
const merged = [];
|
|
@@ -59,10 +39,33 @@ const mergedArray = mergeArrays(
|
|
|
59
39
|
miscSpecializedTerms,
|
|
60
40
|
techComputingConcepts,
|
|
61
41
|
timeAcademicTerms,
|
|
42
|
+
militaryTerms,
|
|
62
43
|
);
|
|
63
44
|
|
|
64
45
|
export const correctTitleCasingList = mergedArray;
|
|
65
46
|
|
|
47
|
+
export const commonShortWords = [
|
|
48
|
+
"the",
|
|
49
|
+
"in",
|
|
50
|
+
"to",
|
|
51
|
+
"within",
|
|
52
|
+
"towards",
|
|
53
|
+
"into",
|
|
54
|
+
"at",
|
|
55
|
+
"of",
|
|
56
|
+
"for",
|
|
57
|
+
"by",
|
|
58
|
+
"on",
|
|
59
|
+
"from",
|
|
60
|
+
"with",
|
|
61
|
+
"through",
|
|
62
|
+
"about",
|
|
63
|
+
"across",
|
|
64
|
+
"over",
|
|
65
|
+
"under",
|
|
66
|
+
"between"
|
|
67
|
+
];
|
|
68
|
+
|
|
66
69
|
export const wordReplacementsList = [
|
|
67
70
|
{ "a.k.a": "AKA" },
|
|
68
71
|
{ "a.s.a.p": "ASAP" },
|
|
@@ -75,7 +78,7 @@ export const wordReplacementsList = [
|
|
|
75
78
|
{ "back-end": "Backend" },
|
|
76
79
|
{ "front-end": "Frontend" },
|
|
77
80
|
{ "full-stack": "Fullstack" },
|
|
78
|
-
{ "nodejs"
|
|
81
|
+
{ "nodejs": "Node.js" },
|
|
79
82
|
{ "nextjs": "Next.js" },
|
|
80
83
|
{ "nuxtjs": "Nuxt.js" },
|
|
81
84
|
{ "reactjs": "React" },
|
|
@@ -84,6 +87,10 @@ export const wordReplacementsList = [
|
|
|
84
87
|
// { 'twitter': 'Twitter, formerly known as 𝕏' }
|
|
85
88
|
];
|
|
86
89
|
|
|
90
|
+
// * ! ===============================================
|
|
91
|
+
// * ! Title Case Styles
|
|
92
|
+
// * ! ===============================================
|
|
93
|
+
|
|
87
94
|
export const titleCaseStylesList = Object.freeze({
|
|
88
95
|
AP: "ap",
|
|
89
96
|
APA: "apa",
|
|
@@ -92,51 +99,199 @@ export const titleCaseStylesList = Object.freeze({
|
|
|
92
99
|
NYT: "nyt",
|
|
93
100
|
WIKIPEDIA: "wikipedia",
|
|
94
101
|
});
|
|
102
|
+
|
|
95
103
|
export const allowedTitleCaseStylesList = Object.values(titleCaseStylesList);
|
|
96
104
|
export const titleCaseDefaultOptionsList = Object.freeze({
|
|
97
105
|
ap: {
|
|
98
106
|
shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
|
|
99
107
|
articlesList: ["a", "an", "the"],
|
|
100
|
-
shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
|
|
108
|
+
shortPrepositionsList: ["as", "at", "by", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "via", "with", "from", "under", "upon", "among"],
|
|
101
109
|
neverCapitalizedList: [],
|
|
102
110
|
},
|
|
103
111
|
apa: {
|
|
104
|
-
shortConjunctionsList: ["and", "
|
|
112
|
+
shortConjunctionsList: ["and", "but", "by", "for", "in", "nor", "of", "on", "or", "so", "to", "yet"],
|
|
105
113
|
articlesList: ["a", "an", "the"],
|
|
106
|
-
shortPrepositionsList: [
|
|
114
|
+
shortPrepositionsList: [
|
|
115
|
+
"about", "above", "across", "after", "against", "along", "among", "around",
|
|
116
|
+
"as", "at", "before", "behind", "below", "beneath", "beside", "between",
|
|
117
|
+
"beyond", "by", "despite", "down", "during", "except", "for", "from", "in",
|
|
118
|
+
"inside", "into", "like", "near", "of", "off", "on", "onto", "out", "outside",
|
|
119
|
+
"over", "past", "since", "through", "throughout", "till", "to", "toward",
|
|
120
|
+
"under", "underneath", "until", "up", "upon", "via", "with", "within", "without"
|
|
121
|
+
],
|
|
107
122
|
neverCapitalizedList: [],
|
|
108
123
|
},
|
|
109
124
|
british: {
|
|
110
125
|
shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
|
|
111
126
|
articlesList: ["a", "an", "the"],
|
|
112
|
-
shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
|
|
127
|
+
shortPrepositionsList: ["as", "at", "by", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "via", "with", "from", "under", "upon"],
|
|
113
128
|
neverCapitalizedList: [],
|
|
114
129
|
},
|
|
115
130
|
chicago: {
|
|
116
131
|
shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
|
|
117
132
|
articlesList: ["a", "an", "the"],
|
|
118
|
-
shortPrepositionsList: ["as", "at", "by", "
|
|
133
|
+
shortPrepositionsList: ["as", "at", "by", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "via", "with", "from", "under", "upon"],
|
|
119
134
|
neverCapitalizedList: ["etc."],
|
|
120
135
|
},
|
|
121
136
|
nyt: {
|
|
122
137
|
shortConjunctionsList: ["and", "but", "or", "for", "nor", "yet", "so"],
|
|
123
138
|
articlesList: ["a", "an", "the"],
|
|
124
|
-
shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
|
|
139
|
+
shortPrepositionsList: ["as", "at", "by", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "via", "with", "from", "under", "upon"],
|
|
125
140
|
neverCapitalizedList: [],
|
|
126
141
|
},
|
|
127
142
|
wikipedia: {
|
|
128
|
-
shortConjunctionsList: ["and", "as", "but", "for", "
|
|
143
|
+
shortConjunctionsList: ["and", "as", "but", "for", "nor", "or", "so", "yet"],
|
|
129
144
|
articlesList: ["a", "an", "the"],
|
|
130
|
-
shortPrepositionsList: ["as", "at", "by", "in", "of", "on", "to", "up", "via"],
|
|
145
|
+
shortPrepositionsList: ["as", "at", "by", "in", "into", "of", "off", "on", "onto", "out", "over", "to", "up", "via", "with", "from", "under", "upon"],
|
|
131
146
|
neverCapitalizedList: [],
|
|
132
|
-
}
|
|
147
|
+
}
|
|
133
148
|
});
|
|
134
149
|
|
|
150
|
+
// * ! ===============================================
|
|
151
|
+
// * ! Ignored Words
|
|
152
|
+
// * ! ===============================================
|
|
153
|
+
|
|
135
154
|
export const ignoredWordList = [];
|
|
155
|
+
|
|
156
|
+
// * ! ===============================================
|
|
157
|
+
// * ! Correct Phrase Casing
|
|
158
|
+
// * ! ===============================================
|
|
159
|
+
|
|
136
160
|
export const correctPhraseCasingList = {
|
|
137
161
|
'the cybersmile foundation': 'The Cybersmile Foundation',
|
|
138
162
|
'co. by colgate': 'CO. by Colgate',
|
|
139
|
-
"on & off":
|
|
140
|
-
"on and off":
|
|
163
|
+
"on & off": "On & Off",
|
|
164
|
+
"on and off": "On and Off",
|
|
141
165
|
};
|
|
142
166
|
|
|
167
|
+
// * ! ===============================================
|
|
168
|
+
// * ! Acronym Replacements
|
|
169
|
+
// * ! ===============================================
|
|
170
|
+
|
|
171
|
+
export const regionalAcronymList = [
|
|
172
|
+
"usa",
|
|
173
|
+
"us",
|
|
174
|
+
"u.s.a",
|
|
175
|
+
"u.s.",
|
|
176
|
+
"u.s",
|
|
177
|
+
"u.s.a.",
|
|
178
|
+
"eu",
|
|
179
|
+
"e.u.",
|
|
180
|
+
"e.u",
|
|
181
|
+
"uk",
|
|
182
|
+
"u.k.",
|
|
183
|
+
"u.k",
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
export const regionalAcronymPrecedingWords = [
|
|
187
|
+
"the", "via", "among", "across", "beyond", "outside",
|
|
188
|
+
"alongside", "throughout", "despite", "unlike", "upon"
|
|
189
|
+
];
|
|
190
|
+
|
|
191
|
+
export const directFollowingIndicatorsRegionalAcronym = [
|
|
192
|
+
"act", "acts",
|
|
193
|
+
"administration", "administrations",
|
|
194
|
+
"agency", "agencies",
|
|
195
|
+
"agreement", "agreements",
|
|
196
|
+
"airforce", "airforces",
|
|
197
|
+
"aid",
|
|
198
|
+
"alliance", "alliances",
|
|
199
|
+
"ambassador", "ambassadors",
|
|
200
|
+
"authority", "authorities",
|
|
201
|
+
"bill", "bills",
|
|
202
|
+
"bloc", "blocs",
|
|
203
|
+
"budget", "budgets",
|
|
204
|
+
"bureau", "bureaus",
|
|
205
|
+
"cabinet", "cabinets",
|
|
206
|
+
"charter", "charters",
|
|
207
|
+
"command", "commands",
|
|
208
|
+
"commission", "commissions",
|
|
209
|
+
"conference", "conferences",
|
|
210
|
+
"congress", "congresses",
|
|
211
|
+
"convention", "conventions",
|
|
212
|
+
"council", "councils",
|
|
213
|
+
"court", "courts",
|
|
214
|
+
"defense", "defences",
|
|
215
|
+
"defence", "defenses",
|
|
216
|
+
"delegation", "delegations",
|
|
217
|
+
"democracy", "democracies",
|
|
218
|
+
"department", "departments",
|
|
219
|
+
"development", "developments",
|
|
220
|
+
"directive", "directives",
|
|
221
|
+
"diplomacy",
|
|
222
|
+
"division", "divisions",
|
|
223
|
+
"economy", "economies",
|
|
224
|
+
"embassy", "embassies",
|
|
225
|
+
"engagement", "engagements",
|
|
226
|
+
"envoy", "envoys",
|
|
227
|
+
"exports",
|
|
228
|
+
"federation", "federations",
|
|
229
|
+
"finance", "finances",
|
|
230
|
+
"forces",
|
|
231
|
+
"framework", "frameworks",
|
|
232
|
+
"funding",
|
|
233
|
+
"government", "governments",
|
|
234
|
+
"hearing", "hearings",
|
|
235
|
+
"imports",
|
|
236
|
+
"initiative", "initiatives",
|
|
237
|
+
"intel",
|
|
238
|
+
"intelligence",
|
|
239
|
+
"intervention", "interventions",
|
|
240
|
+
"jurisdiction", "jurisdictions",
|
|
241
|
+
"law", "laws",
|
|
242
|
+
"leadership", "leaders",
|
|
243
|
+
"legislation",
|
|
244
|
+
"liaison", "liaisons",
|
|
245
|
+
"mandate", "mandates",
|
|
246
|
+
"markets",
|
|
247
|
+
"marines",
|
|
248
|
+
"military", "militaries",
|
|
249
|
+
"ministry", "ministries",
|
|
250
|
+
"mission", "missions",
|
|
251
|
+
"navy", "navies",
|
|
252
|
+
"negotiations",
|
|
253
|
+
"office", "offices",
|
|
254
|
+
"operations",
|
|
255
|
+
"oversight",
|
|
256
|
+
"parliament", "parliaments",
|
|
257
|
+
"plan", "plans",
|
|
258
|
+
"policies", "policy",
|
|
259
|
+
"policy-makers",
|
|
260
|
+
"precedent", "precedents",
|
|
261
|
+
"presence",
|
|
262
|
+
"program", "programme", "programmes", "programs",
|
|
263
|
+
"project", "projects",
|
|
264
|
+
"protocol", "protocols",
|
|
265
|
+
"province", "provinces",
|
|
266
|
+
"reform", "reforms",
|
|
267
|
+
"regulation", "regulations",
|
|
268
|
+
"regulator", "regulators",
|
|
269
|
+
"relations",
|
|
270
|
+
"representation", "representations",
|
|
271
|
+
"republic", "republics",
|
|
272
|
+
"resolution", "resolutions",
|
|
273
|
+
"ruling", "rulings",
|
|
274
|
+
"sanctions",
|
|
275
|
+
"security", "securities",
|
|
276
|
+
"senate", "senates",
|
|
277
|
+
"service", "services",
|
|
278
|
+
"state", "states",
|
|
279
|
+
"statute", "statutes",
|
|
280
|
+
"strategy", "strategies",
|
|
281
|
+
"summit", "summits",
|
|
282
|
+
"summitry",
|
|
283
|
+
"surveillance",
|
|
284
|
+
"talks",
|
|
285
|
+
"tariffs",
|
|
286
|
+
"territory", "territories",
|
|
287
|
+
"trade", "trades",
|
|
288
|
+
"treasury", "treasuries",
|
|
289
|
+
"treaty", "treaties",
|
|
290
|
+
"tribunal", "tribunals",
|
|
291
|
+
"troops",
|
|
292
|
+
"union", "unions",
|
|
293
|
+
"veterans",
|
|
294
|
+
"warships",
|
|
295
|
+
"zone", "zones"
|
|
296
|
+
];
|
|
297
|
+
|