react-material-overlay
Version:
A fully featured Material UI implementation of overlays like modals, alert dialogs, lightboxes, and bottom sheets featuring easy stack management and browser history integration
19 lines (11 loc) • 637 B
text/typescript
import { isValidElement } from 'react';
import { Id } from '../types';
export const isNum = (v: any): v is number => typeof v === 'number' && !isNaN(v);
export const isStr = (v: any): v is string => typeof v === 'string';
export const isFn = (v: any): v is Function => typeof v === 'function';
export const isId = (v: unknown): v is Id => isStr(v) || isNum(v);
export function isReactRef(value: unknown) {
return !!value && typeof value === 'object' && 'current' in value;
}
export const canBeRendered = <T>(content: T): boolean =>
isValidElement(content) || isStr(content) || isFn(content) || isNum(content);