@danielhaim/titlecaser 1.2.59 → 1.2.61
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/package.json +1 -1
- package/src/TitleCaser.js +2 -4
- package/src/TitleCaserConsts.js +6 -19
package/package.json
CHANGED
package/src/TitleCaser.js
CHANGED
|
@@ -111,10 +111,8 @@ export class TitleCaser {
|
|
|
111
111
|
const isReplaced = !replacedParts.every((part, index) => part === parts[index]);
|
|
112
112
|
|
|
113
113
|
// Reassemble the word with the hyphen, reattach trailing punctuation, and return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
trailingPunctuation
|
|
117
|
-
);
|
|
114
|
+
const processedWord = isReplaced ? replacedParts.join("-") : TitleCaserUtils.correctTermHyphenated(word, style);
|
|
115
|
+
return processedWord.endsWith(trailingPunctuation) ? processedWord : processedWord + trailingPunctuation;
|
|
118
116
|
case TitleCaserUtils.hasSuffix(word, style):
|
|
119
117
|
// If the word has a suffix, return the correct casing.
|
|
120
118
|
return TitleCaserUtils.correctSuffix(word, correctTitleCasingList);
|
package/src/TitleCaserConsts.js
CHANGED
|
@@ -64,36 +64,23 @@ const mergedArray = mergeArrays(
|
|
|
64
64
|
export const correctTitleCasingList = mergedArray;
|
|
65
65
|
|
|
66
66
|
export const wordReplacementsList = [
|
|
67
|
-
{ "e-book": "eBook" },
|
|
68
|
-
{ "e-books": "eBooks" },
|
|
69
|
-
{ "e-commerce": "eCommerce" },
|
|
70
|
-
{ ecom: "eCommerce" },
|
|
71
|
-
{ ecommerce: "eCommerce" },
|
|
72
67
|
{ "a.k.a": "AKA" },
|
|
73
68
|
{ "a.s.a.p": "ASAP" },
|
|
74
69
|
{ "f.a.q": "FAQ" },
|
|
75
|
-
{ "f.a.q.a": "FAQs" },
|
|
76
70
|
{ "f.a.q.s": "FAQs" },
|
|
77
71
|
{ "f.y.i": "FYI" },
|
|
78
72
|
{ "d.i.y": "DIY" },
|
|
79
73
|
{ "t.b.d": "TBD" },
|
|
80
|
-
{ phd: "Ph.D." },
|
|
81
74
|
{ "back-end": "Backend" },
|
|
82
75
|
{ "front-end": "Frontend" },
|
|
83
76
|
{ "full-stack": "Fullstack" },
|
|
84
|
-
{
|
|
85
|
-
{ nextjs: "Next.js" },
|
|
86
|
-
{
|
|
87
|
-
{
|
|
88
|
-
{
|
|
89
|
-
{ vuejs: "Vue.js" },
|
|
77
|
+
{ "nodejs" : "Node.js" },
|
|
78
|
+
{ "nextjs": "Next.js" },
|
|
79
|
+
{ "nuxtjs": "Nuxt.js" },
|
|
80
|
+
{ "reactjs": "React" },
|
|
81
|
+
{ "react.js": "React" },
|
|
90
82
|
{ "cyber-security": "Cybersecurity" },
|
|
91
|
-
{
|
|
92
|
-
{ mcdonalds: "McDonald's" },
|
|
93
|
-
{ sainsburys: "Sainsbury's" },
|
|
94
|
-
{ hersheys: "Hershey's" },
|
|
95
|
-
{ kellogs: "Kellogg's" },
|
|
96
|
-
{ dominos: "Domino's" },
|
|
83
|
+
// { 'twitter': '𝕏' }
|
|
97
84
|
];
|
|
98
85
|
|
|
99
86
|
export const titleCaseStylesList = Object.freeze({
|