typeguru
Version:
TypeGuru is a lightweight TypeScript utility library for type checking. It includes utility functions for checking object literals, plain objects, specific types, and more.
15 lines (13 loc) • 443 B
text/typescript
import { IsObjectLiteral } from "../types";
const isObjectLiteral: IsObjectLiteral = (value: unknown): boolean => {
return (
typeof value === "object" &&
value !== null &&
!Array.isArray(value) &&
!(value instanceof Map) &&
!(value instanceof Set) &&
!(value instanceof RegExp) &&
!(value instanceof Date)
)
}
export default isObjectLiteral