UNPKG

tupleson

Version:

A hackable JSON serializer/deserializer

16 lines (12 loc) 317 B
export const isPlainObject = (obj: unknown): obj is Record<string, unknown> => { if (!obj || typeof obj !== "object") { return false; } if (obj === Object.prototype) { return false; } if (Object.getPrototypeOf(obj) === null) { return true; } return Object.getPrototypeOf(obj) === Object.prototype; };