• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

teableio / teable / 10160390019

30 Jul 2024 10:08AM CUT coverage: 81.98% (+64.3%) from 17.697%
10160390019

Pull #779

github

web-flow
Merge a160876c8 into 521460d76
Pull Request #779: fix: skip duplicate index

4272 of 4471 branches covered (95.55%)

28270 of 34484 relevant lines covered (81.98%)

1219.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/nestjs-backend/src/features/calculation/utils/name-console.ts
1
// eslint-disable-next-line @typescript-eslint/no-explicit-any, sonarjs/cognitive-complexity
×
2
function replaceFieldIdsWithNames(obj: any, fieldMap: { [fieldId: string]: { name: string } }) {
×
3
  if (typeof obj === 'object' && obj !== null) {
×
4
    for (const key in obj) {
×
5
      // eslint-disable-next-line no-prototype-builtins
×
6
      if (obj.hasOwnProperty(key)) {
×
7
        let newKey = key;
×
8
        if (key.startsWith('fld') && fieldMap[key]) {
×
9
          newKey = fieldMap[key].name;
×
10
        }
×
11
        obj[newKey] = replaceFieldIdsWithNames(obj[key], fieldMap);
×
12
        if (newKey !== key) delete obj[key];
×
13
      }
×
14
    }
×
15
  } else if (typeof obj === 'string' && obj.startsWith('fld') && fieldMap[obj]) {
×
16
    obj = fieldMap[obj].name;
×
17
  }
×
18
  return obj;
×
19
}
×
20

×
21
export function nameConsole(
×
22
  key: string,
×
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
×
24
  obj: any,
×
25
  fieldMap: { [fieldId: string]: { name: string } }
×
26
) {
×
27
  obj = JSON.parse(JSON.stringify(obj));
×
28
  console.log(key, JSON.stringify(replaceFieldIdsWithNames(obj, fieldMap), null, 2));
×
29
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc