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

yiming-liao / logry / 15710162848

17 Jun 2025 02:31PM UTC coverage: 96.783% (-0.2%) from 96.994%
15710162848

push

github

yiming-liao
docs(readme): minor wording updates

457 of 479 branches covered (95.41%)

Branch coverage included in aggregate %.

4296 of 4432 relevant lines covered (96.93%)

2.71 hits per line

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

90.32
/src/modules/formatters/utils/try-custom-formatter.ts
1
import { internalError } from "@/internal";
1✔
2

1✔
3
type TryCustomFormatterOptions<Input, Result> = {
1✔
4
  label: string;
1✔
5
  input: Input;
1✔
6
  customFormatter: ((input: Input) => Result) | undefined;
1✔
7
};
1✔
8

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