Skip to content

Commit fbf614d

Browse files
committed
various cleanups and update package.json
1 parent d3e4919 commit fbf614d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

namecase.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
// Name case Mcs and Macs
4444
// Exclude names with 1-2 letters after prefix like Mack, Macky, Mace
4545
// Exclude names ending in a,c,i,o, or j are typically Polish or Italian
46-
4746
if (new RegExp(/\bMac[A-Za-z]{2,}[^aciozj]\b/).test(el) ||
4847
new RegExp(/\bMc/).test(el)) {
4948

@@ -87,11 +86,10 @@
8786
// And correct Mac exceptions otherwise missed
8887
el = el
8988
.replace(/\bMacmurdo/, "MacMurdo")
90-
.replace(/\bMacisaac/, "MacIsaac");
89+
.replace(/\bMacisaac/, "MacIsaac")
9190

9291

9392
// Fixes for "son (daughter) of" etc. in various languages.
94-
el = el
9593
.replace(/\bAl(?=\s+\w)/g, "al") // al Arabic or forename Al.
9694
.replace(/\bAp\b/g, "ap") // ap Welsh.
9795
.replace(/\bBen(?=\s+\w)\b/g, "ben") // ben Hebrew or forename Ben.
@@ -102,18 +100,20 @@
102100
.replace(/\bLa\b/g, "la") // la French
103101
.replace(/\bL([eo])\b/g, "l$1") // lo Italian; le French.
104102
.replace(/\bVan(?=\s+\w)/g, "van") // van German or forename Van.
105-
.replace(/\bVon\b/g, "von"); // von Dutch/Flemish
103+
.replace(/\bVon\b/g, "von") // von Dutch/Flemish
106104

107105

108106
// Fixes for roman numeral names, e.g. Henry VIII
109-
el = el.replace(/\b(?:\d{4}|(?:[IVX])(?:X{0,3}I{0,3}|X{0,2}VI{0,3}|X{0,2}I?[VX]))$/i,
110-
function (v) {
111-
return v.toUpperCase();
112-
});
107+
.replace(/\b(?:\d{4}|(?:[IVX])(?:X{0,3}I{0,3}|X{0,2}VI{0,3}|X{0,2}I?[VX]))$/i,
108+
function (v) {
109+
return v.toUpperCase();
110+
})
113111

114112

115113
// Nation of Islam 2X, 3X, etc. names
116-
el = el.replace(/\b[0-9](x)\b/, function (v) { return v.toUpperCase(); } );
114+
.replace(/\b[0-9](x)\b/, function (v) { return v.toUpperCase(); } )
115+
116+
117117
// Somewhat arbitrary rule where two letter combos not containing vowels should be capitalized
118118
// fixes /JJ Abrams/ and /JD Salinger/
119119
// With some exceptions
@@ -134,7 +134,7 @@
134134
.replace(/\bY\s/g, "y");
135135

136136
return el;
137-
}
137+
};
138138

139139

140140
if (typeof exports !== 'undefined') {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "namecase",
3-
"version": "v0.0.1",
3+
"version": "v0.0.2",
44
"description": "Module for fixing capitalization of people's names",
55
"keywords": [
66
"namecase",
@@ -25,5 +25,6 @@
2525
"scripts": {
2626
"test": "./node_modules/mocha/bin/mocha test"
2727
},
28+
"bin": "./bin/namecase",
2829
"bugs": "https://github.com/emgee3/namecase/issues"
2930
}

0 commit comments

Comments
 (0)