Skip to content

Commit a7b633c

Browse files
committed
upgrade humanify to also skip formatting strings with punctuation
1 parent 5b313f1 commit a7b633c

6 files changed

+20
-6
lines changed

dist/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,11 @@ function splitTitleCase(s) {
12781278
return to.filter(x => !!x);
12791279
}
12801280
exports.splitTitleCase = splitTitleCase;
1281-
function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : (0, exports.ucFirst)(splitTitleCase(s).join(' ')); }
1281+
function humanify(s) {
1282+
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
1283+
? s
1284+
: (0, exports.ucFirst)(splitTitleCase(s).join(' '));
1285+
}
12821286
exports.humanify = humanify;
12831287
function queryString(url) {
12841288
if (!url || url.indexOf('?') === -1)

dist/servicestack-client.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/servicestack-client.min.mjs

+1-1
Large diffs are not rendered by default.

dist/servicestack-client.mjs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,11 @@ export function splitTitleCase(s) {
13611361
to.push(s.substring(lastSplit, s.length));
13621362
return to.filter(x => !!x);
13631363
}
1364-
export function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : ucFirst(splitTitleCase(s).join(' ')); }
1364+
export function humanify(s) {
1365+
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
1366+
? s
1367+
: ucFirst(splitTitleCase(s).join(' '));
1368+
}
13651369
export function queryString(url) {
13661370
if (!url || url.indexOf('?') === -1)
13671371
return {};

dist/servicestack-client.umd.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
15321532
return to.filter(function (x) { return !!x; });
15331533
}
15341534
exports.splitTitleCase = splitTitleCase;
1535-
function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : (0, exports.ucFirst)(splitTitleCase(s).join(' ')); }
1535+
function humanify(s) {
1536+
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
1537+
? s
1538+
: (0, exports.ucFirst)(splitTitleCase(s).join(' '));
1539+
}
15361540
exports.humanify = humanify;
15371541
function queryString(url) {
15381542
if (!url || url.indexOf('?') === -1)

src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,9 @@ export function splitTitleCase(s:string) {
17131713
return to.filter(x => !!x)
17141714
}
17151715

1716-
export function humanify(s?:string|null) { return !s || s.indexOf(' ') >= 0 ? s : ucFirst(splitTitleCase(s).join(' ')) }
1716+
export function humanify(s?:string|null) { return !s || indexOfAny(s,[' ',',','.',':','-']) >= 0
1717+
? s
1718+
: ucFirst(splitTitleCase(s).join(' ')) }
17171719

17181720
export function queryString(url: string): any {
17191721
if (!url || url.indexOf('?') === -1) return {}

0 commit comments

Comments
 (0)