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

yiming-liao / logry / 15724215662

18 Jun 2025 04:54AM UTC coverage: 98.439% (-0.06%) from 98.501%
15724215662

push

github

yiming-liao
refactor(examples): reorganize and clean up example files

483 of 509 branches covered (94.89%)

Branch coverage included in aggregate %.

4374 of 4425 relevant lines covered (98.85%)

3.57 hits per line

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

90.63
/src/modules/normalizers/utils/try-custom-normalizer.ts
1
import { internalError } from "@/internal";
1✔
2

1✔
3
type TryCustomNormalizerOptions<Input, Result> = {
1✔
4
  label: string;
1✔
5
  input: Input;
1✔
6
  customNormalizer?: (input: Input) => Result;
1✔
7
};
1✔
8

1✔
9
/**
1✔
10
 * Safely executes a custom normalizer if provided.
1✔
11
 *
1✔
12
 * @param label - Label for error reporting.
1✔
13
 * @param input - Input to pass into the custom normalizer.
1✔
14
 * @param customNormalizer - Optional custom normalizer function.
1✔
15
 * @returns Result of the custom normalizer or undefined on failure.
1✔
16
 */
1✔
17
export const tryCustomNormalizer = <Input, Result>({
1✔
18
  label,
14✔
19
  input,
14✔
20
  customNormalizer,
14✔
21
}: TryCustomNormalizerOptions<Input, Result>): Result | undefined => {
14✔
22
  if (typeof customNormalizer === "function") {
14✔
23
    try {
5✔
24
      return customNormalizer(input);
5✔
25
    } catch (error) {
5!
26
      internalError({ error, message: `custom ${label} normalizer failed.` });
×
27
    }
×
28
  }
5✔
29
};
14✔
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

© 2026 Coveralls, Inc