MCPcopy Create free account
hub / github.com/CapSoftware/Cap / normalizeOverlayPosition

Function normalizeOverlayPosition

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

Source from the content-addressed store, hash-verified

741};
742
743const normalizeOverlayPosition = (value: unknown): OverlayPosition | null => {
744 if (!value || typeof value !== "object") return null;
745 const candidate = value as Partial<OverlayPosition>;
746 if (
747 typeof candidate.x !== "number" ||
748 typeof candidate.y !== "number" ||
749 typeof candidate.viewportWidth !== "number" ||
750 typeof candidate.viewportHeight !== "number" ||
751 typeof candidate.updatedAt !== "number" ||
752 !Number.isFinite(candidate.x) ||
753 !Number.isFinite(candidate.y) ||
754 !Number.isFinite(candidate.viewportWidth) ||
755 !Number.isFinite(candidate.viewportHeight) ||
756 !Number.isFinite(candidate.updatedAt)
757 ) {
758 return null;
759 }
760
761 return {
762 x: candidate.x,
763 y: candidate.y,
764 viewportWidth: Math.max(1, candidate.viewportWidth),
765 viewportHeight: Math.max(1, candidate.viewportHeight),
766 updatedAt: candidate.updatedAt,
767 };
768};
769
770const RECORDING_PHASES = new Set([
771 "idle",

Callers 1

normalizeOverlayUiStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected