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

yiming-liao / logry / 15760940083

19 Jun 2025 03:02PM UTC coverage: 96.733% (+0.08%) from 96.654%
15760940083

push

github

yiming-liao
docs(examples): update examples and cleanup

509 of 552 branches covered (92.21%)

Branch coverage included in aggregate %.

4672 of 4804 relevant lines covered (97.25%)

4.24 hits per line

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

77.42
/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,
64✔
19
  input,
64✔
20
  customNormalizer,
64✔
21
}: TryCustomNormalizerOptions<Input, Result>): Result | undefined => {
64✔
22
  if (typeof customNormalizer === "function") {
64!
23
    try {
×
24
      return customNormalizer(input);
×
25
    } catch (error) {
×
26
      internalError({ error, message: `custom ${label} normalizer failed.` });
×
27
    }
×
28
  }
×
29
};
64✔
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