@radix-ui/themes
Version:
[](https://radix-ui.com/themes)
16 lines (13 loc) • 434 B
text/typescript
import { breakpoints } from '../props/prop-def.js';
import type { Responsive, Breakpoint } from '../props/prop-def.js';
export function isResponsiveObject<Value extends string>(
obj: Responsive<Value | Omit<string, Value>> | undefined,
): obj is Record<Breakpoint, string> {
return (
typeof obj === 'object' &&
obj !== null &&
Object.keys(obj).some((key) => {
return breakpoints.has(key as any);
})
);
}