Browse Source

fix linter errors

pull/5843/head
Laaaaksh 2 months ago
parent
commit
c6e0c13528
  1. 9
      apps/api/src/helper/object.helper.ts

9
apps/api/src/helper/object.helper.ts

@ -62,8 +62,7 @@ function fastClone(obj: any, seen = new WeakMap()): any {
const cloned: any = {}; const cloned: any = {};
seen.set(obj, cloned); seen.set(obj, cloned);
const keys = Object.keys(obj); const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) { for (const key of keys) {
const key = keys[i];
cloned[key] = fastClone(obj[key], seen); cloned[key] = fastClone(obj[key], seen);
} }
return cloned; return cloned;
@ -128,8 +127,7 @@ export function redactAttributes({
// Optimization 4: Use Object.keys() instead of for...in (faster, no inherited props) // Optimization 4: Use Object.keys() instead of for...in (faster, no inherited props)
const keys = Object.keys(current); const keys = Object.keys(current);
for (let i = 0; i < keys.length; i++) { for (const key of keys) {
const key = keys[i];
const value = current[key]; const value = current[key];
// Optimization 5: Cache type check // Optimization 5: Cache type check
@ -141,8 +139,7 @@ export function redactAttributes({
if (isArray(value)) { if (isArray(value)) {
// Optimization 6: Batch array processing // Optimization 6: Batch array processing
if (value.length > 0) { if (value.length > 0) {
for (let j = 0; j < value.length; j++) { for (const item of value) {
const item = value[j];
if (item != null && typeof item === 'object') { if (item != null && typeof item === 'object') {
workQueue.push(item); workQueue.push(item);
} }

Loading…
Cancel
Save