Skip to content

Commit

Permalink
upgrade humanify to also skip formatting strings with punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Oct 6, 2024
1 parent 5b313f1 commit a7b633c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,11 @@ function splitTitleCase(s) {
return to.filter(x => !!x);
}
exports.splitTitleCase = splitTitleCase;
function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : (0, exports.ucFirst)(splitTitleCase(s).join(' ')); }
function humanify(s) {
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
? s
: (0, exports.ucFirst)(splitTitleCase(s).join(' '));
}
exports.humanify = humanify;
function queryString(url) {
if (!url || url.indexOf('?') === -1)
Expand Down
2 changes: 1 addition & 1 deletion dist/servicestack-client.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/servicestack-client.min.mjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/servicestack-client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,11 @@ export function splitTitleCase(s) {
to.push(s.substring(lastSplit, s.length));
return to.filter(x => !!x);
}
export function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : ucFirst(splitTitleCase(s).join(' ')); }
export function humanify(s) {
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
? s
: ucFirst(splitTitleCase(s).join(' '));
}
export function queryString(url) {
if (!url || url.indexOf('?') === -1)
return {};
Expand Down
6 changes: 5 additions & 1 deletion dist/servicestack-client.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
return to.filter(function (x) { return !!x; });
}
exports.splitTitleCase = splitTitleCase;
function humanify(s) { return !s || s.indexOf(' ') >= 0 ? s : (0, exports.ucFirst)(splitTitleCase(s).join(' ')); }
function humanify(s) {
return !s || indexOfAny(s, [' ', ',', '.', ':', '-']) >= 0
? s
: (0, exports.ucFirst)(splitTitleCase(s).join(' '));
}
exports.humanify = humanify;
function queryString(url) {
if (!url || url.indexOf('?') === -1)
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,9 @@ export function splitTitleCase(s:string) {
return to.filter(x => !!x)
}

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

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

0 comments on commit a7b633c

Please sign in to comment.