MCPcopy
hub / github.com/CapSoftware/Cap / normalizeCountdownSettings

Function normalizeCountdownSettings

apps/chrome-extension/src/shared/storage.ts:680–703  ·  view source on GitHub ↗
(
	value: unknown,
)

Source from the content-addressed store, hash-verified

678const ALLOWED_COUNTDOWN_SECONDS = [3, 5, 10];
679
680const normalizeCountdownSettings = (
681 value: unknown,
682): ExtensionSettings["countdown"] => {
683 const countdown =
684 value && typeof value === "object"
685 ? (value as Partial<ExtensionSettings["countdown"]>)
686 : {};
687 const seconds =
688 typeof countdown.seconds === "number" &&
689 Number.isFinite(countdown.seconds) &&
690 countdown.seconds > 0
691 ? Math.round(countdown.seconds)
692 : defaultSettings.countdown.seconds;
693
694 return {
695 enabled:
696 typeof countdown.enabled === "boolean"
697 ? countdown.enabled
698 : defaultSettings.countdown.enabled,
699 seconds: ALLOWED_COUNTDOWN_SECONDS.includes(seconds)
700 ? seconds
701 : defaultSettings.countdown.seconds,
702 };
703};
704
705const normalizeMicrophoneWarningSettings = (
706 value: unknown,

Callers 1

loadSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected