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

kulshekhar / ts-jest / 9804725795

05 Jul 2024 07:30AM UTC coverage: 96.474%. Remained the same
9804725795

push

github

ahnpnl
build(deps): Update dependency eslint-plugin-jsdoc to ^48.5.1

788 of 885 branches covered (89.04%)

Branch coverage included in aggregate %.

4712 of 4816 relevant lines covered (97.84%)

1248.26 hits per line

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

92.06
/src/utils/json.ts
1
/* eslint-disable no-redeclare */
6✔
2
import stableStringify from 'fast-json-stable-stringify'
6✔
3

6✔
4
const UNDEFINED = 'undefined'
6✔
5

6✔
6
export function stringify(input: unknown): string {
1,219✔
7
  return input === undefined ? UNDEFINED : stableStringify(input)
1,219✔
8
}
1,219✔
9

6✔
10
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6✔
11
export function parse(input: string): any {
12✔
12
  return input === UNDEFINED ? undefined : JSON.parse(input)
12✔
13
}
12✔
14

6✔
15
interface NormalizeOptions {
6✔
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6✔
17
  parse?: (input: string) => any
6✔
18
}
6✔
19
/**
6✔
20
 * @internal
6✔
21
 */
6✔
22
export function normalize(input: string, { parse: parser = parse }: NormalizeOptions = {}): string {
24✔
23
  let result: string | undefined
24✔
24
  if (normalize.cache.has(input)) {
24✔
25
    result = normalize.cache.get(input)
6✔
26
  } else {
24✔
27
    const data = parser(input)
18✔
28
    result = stringify(data)
18✔
29
    if (result === input) result = undefined
18!
30
    normalize.cache.set(input, result)
18✔
31
  }
18✔
32

24✔
33
  return result === undefined ? input : result
24!
34
}
24✔
35

6✔
36
/**
6✔
37
 * @internal
6✔
38
 */
6✔
39
// eslint-disable-next-line @typescript-eslint/no-namespace
6✔
40
export namespace normalize {
41✔
41
  export const cache = new Map<string, string | undefined>()
41✔
42
}
41!
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