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

panates / postgresql-client / 50d5a8f1-a1ba-4c39-947d-fb4f2c7685e1

16 Apr 2024 07:12AM UTC coverage: 85.802% (+0.3%) from 85.476%
50d5a8f1-a1ba-4c39-947d-fb4f2c7685e1

push

circleci

erayhanoglu
Added prettier formatting

696 of 980 branches covered (71.02%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

52 existing lines in 10 files now uncovered.

2513 of 2760 relevant lines covered (91.05%)

799.06 hits per line

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

85.29
/src/util/stringify-arrayliteral.ts
1
import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
2
import { EncodeTextFunction } from '../types.js';
3
import { arrayCalculateDim } from './array-calculatedim.js';
30✔
4

5
export function stringifyArrayLiteral(value: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string {
30✔
6
  const dim = arrayCalculateDim(value);
9✔
7
  const writeDim = (arr: any[], level: number) => {
9✔
8
    const elemCount = dim[level];
63✔
9
    const out: string[] = [];
63✔
10
    for (let i = 0; i < elemCount; i++) {
63✔
11
      let x = arr && arr[i];
162✔
12
      if (level < dim.length - 1) {
162✔
13
        if (x != null && !Array.isArray(x)) x = [x];
54!
14
        out.push(writeDim(x, level + 1));
54✔
15
        continue;
54✔
16
      }
17
      // if value is null
18
      if (x == null) {
108✔
19
        out.push('NULL');
36✔
20
        continue;
36✔
21
      }
22
      if (Array.isArray(x)) {
72!
UNCOV
23
        out.push(stringifyArrayLiteral(x, options, encode));
×
UNCOV
24
        continue;
×
25
      }
26
      if (encode) x = encode(x, options || {});
72!
27
      out.push(escapeArrayItem('' + x));
72✔
28
    }
29
    return '{' + out.join(',') + '}';
63✔
30
  };
31
  return writeDim(value, 0);
9✔
32
}
33

34
function escapeArrayItem(str: string): string {
35
  return '"' + str.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
72✔
36
}
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