Skip to content

Commit

Permalink
update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Feb 4, 2025
1 parent 6edf661 commit f4dbaf5
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 14 deletions.
36 changes: 32 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ function createFieldError(fieldName, message, errorCode = 'Exception') {
return new ResponseStatus({ errors: [new ResponseError({ fieldName, errorCode, message })] });
}
exports.createFieldError = createFieldError;
function isFormData(body) { return typeof window != "undefined" && body instanceof FormData; }
function isFormData(body) { return body instanceof FormData; }
exports.isFormData = isFormData;
function createErrorResponse(errorCode, message, type = null) {
const error = apply(new ErrorResponse(), e => {
Expand All @@ -1114,11 +1114,39 @@ function createError(errorCode, message, fieldName) {
});
}
exports.createError = createError;
function toCamelCase(s) { return !s ? s : s.charAt(0).toLowerCase() + s.substring(1); }
function toCamelCase(s) {
s = toPascalCase(s);
if (!s)
return '';
return s.charAt(0).toLowerCase() + s.substring(1);
}
exports.toCamelCase = toCamelCase;
function toPascalCase(s) { return !s ? s : s.charAt(0).toUpperCase() + s.substring(1); }
function toPascalCase(s) {
if (!s)
return '';
const isAllCaps = s.match(/^[A-Z0-9_]+$/);
if (isAllCaps) {
const words = s.split('_');
return words.map(x => x[0].toUpperCase() + x.substring(1).toLowerCase()).join('');
}
if (s.includes('_')) {
return s.split('_').filter(x => x[0]).map(x => x[0].toUpperCase() + x.substring(1)).join('');
}
return s.charAt(0).toUpperCase() + s.substring(1);
}
exports.toPascalCase = toPascalCase;
function toKebabCase(s) { return (s || '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); }
function toKebabCase(s) {
if (!s || s.length <= 1)
return s.toLowerCase();
// Insert hyphen before capitals and numbers, convert to lowercase
return s
.replace(/([A-Z0-9])/g, '-$1')
.toLowerCase()
// Remove leading hyphen if exists
.replace(/^-/, '')
// Replace multiple hyphens with single hyphen
.replace(/-+/g, '-');
}
exports.toKebabCase = toKebabCase;
function map(o, f) { return o == null ? null : f(o); }
exports.map = map;
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.

36 changes: 32 additions & 4 deletions dist/servicestack-client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ export function createErrorStatus(message, errorCode = 'Exception') {
export function createFieldError(fieldName, message, errorCode = 'Exception') {
return new ResponseStatus({ errors: [new ResponseError({ fieldName, errorCode, message })] });
}
export function isFormData(body) { return typeof window != "undefined" && body instanceof FormData; }
export function isFormData(body) { return body instanceof FormData; }
function createErrorResponse(errorCode, message, type = null) {
const error = apply(new ErrorResponse(), e => {
if (type != null)
Expand All @@ -1219,9 +1219,37 @@ export function createError(errorCode, message, fieldName) {
})
});
}
export function toCamelCase(s) { return !s ? s : s.charAt(0).toLowerCase() + s.substring(1); }
export function toPascalCase(s) { return !s ? s : s.charAt(0).toUpperCase() + s.substring(1); }
export function toKebabCase(s) { return (s || '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); }
export function toCamelCase(s) {
s = toPascalCase(s);
if (!s)
return '';
return s.charAt(0).toLowerCase() + s.substring(1);
}
export function toPascalCase(s) {
if (!s)
return '';
const isAllCaps = s.match(/^[A-Z0-9_]+$/);
if (isAllCaps) {
const words = s.split('_');
return words.map(x => x[0].toUpperCase() + x.substring(1).toLowerCase()).join('');
}
if (s.includes('_')) {
return s.split('_').filter(x => x[0]).map(x => x[0].toUpperCase() + x.substring(1)).join('');
}
return s.charAt(0).toUpperCase() + s.substring(1);
}
export function toKebabCase(s) {
if (!s || s.length <= 1)
return s.toLowerCase();
// Insert hyphen before capitals and numbers, convert to lowercase
return s
.replace(/([A-Z0-9])/g, '-$1')
.toLowerCase()
// Remove leading hyphen if exists
.replace(/^-/, '')
// Replace multiple hyphens with single hyphen
.replace(/-+/g, '-');
}
export function map(o, f) { return o == null ? null : f(o); }
export function camelCaseAny(o) {
if (!o || !(o instanceof Object) || Array.isArray(o))
Expand Down
36 changes: 32 additions & 4 deletions dist/servicestack-client.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
return new ResponseStatus({ errors: [new ResponseError({ fieldName: fieldName, errorCode: errorCode, message: message })] });
}
exports.createFieldError = createFieldError;
function isFormData(body) { return typeof window != "undefined" && body instanceof FormData; }
function isFormData(body) { return body instanceof FormData; }
exports.isFormData = isFormData;
function createErrorResponse(errorCode, message, type) {
if (type === void 0) { type = null; }
Expand All @@ -1366,11 +1366,39 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
});
}
exports.createError = createError;
function toCamelCase(s) { return !s ? s : s.charAt(0).toLowerCase() + s.substring(1); }
function toCamelCase(s) {
s = toPascalCase(s);
if (!s)
return '';
return s.charAt(0).toLowerCase() + s.substring(1);
}
exports.toCamelCase = toCamelCase;
function toPascalCase(s) { return !s ? s : s.charAt(0).toUpperCase() + s.substring(1); }
function toPascalCase(s) {
if (!s)
return '';
var isAllCaps = s.match(/^[A-Z0-9_]+$/);
if (isAllCaps) {
var words = s.split('_');
return words.map(function (x) { return x[0].toUpperCase() + x.substring(1).toLowerCase(); }).join('');
}
if (s.includes('_')) {
return s.split('_').filter(function (x) { return x[0]; }).map(function (x) { return x[0].toUpperCase() + x.substring(1); }).join('');
}
return s.charAt(0).toUpperCase() + s.substring(1);
}
exports.toPascalCase = toPascalCase;
function toKebabCase(s) { return (s || '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); }
function toKebabCase(s) {
if (!s || s.length <= 1)
return s.toLowerCase();
// Insert hyphen before capitals and numbers, convert to lowercase
return s
.replace(/([A-Z0-9])/g, '-$1')
.toLowerCase()
// Remove leading hyphen if exists
.replace(/^-/, '')
// Replace multiple hyphens with single hyphen
.replace(/-+/g, '-');
}
exports.toKebabCase = toKebabCase;
function map(o, f) { return o == null ? null : f(o); }
exports.map = map;
Expand Down

0 comments on commit f4dbaf5

Please sign in to comment.