tslint errors fix

master
Tudor Stanciu 2023-03-30 19:13:30 +03:00
parent ea62905a56
commit 7ac45f1d86
1 changed files with 5 additions and 5 deletions

View File

@ -4,11 +4,11 @@ interface ObjectWithAnyKey {
[key: string]: any; [key: string]: any;
} }
function camelizeKeys(o: any): any { const camelizeKeys = (o: any): any => {
if (!o || (typeof o !== "object" && !Array.isArray(o))) return o; if (!o || (typeof o !== "object" && !Array.isArray(o))) return o;
let newO, value; let newO;
if (o instanceof Array) { if (o instanceof Array) {
return o.map(function (value) { return o.map(value => {
if (typeof value === "object") { if (typeof value === "object") {
value = camelizeKeys(value); value = camelizeKeys(value);
} }
@ -21,7 +21,7 @@ function camelizeKeys(o: any): any {
const newKey = ( const newKey = (
origKey.charAt(0).toLowerCase() + origKey.slice(1) || origKey origKey.charAt(0).toLowerCase() + origKey.slice(1) || origKey
).toString(); ).toString();
value = o[origKey]; let value = o[origKey];
if ( if (
value instanceof Array || value instanceof Array ||
(value !== null && value.constructor === Object) (value !== null && value.constructor === Object)
@ -33,6 +33,6 @@ function camelizeKeys(o: any): any {
} }
} }
return newO; return newO;
} };
export { camelizeKeys }; export { camelizeKeys };