• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * @param obj The object to inspect.
3 * @returns True if the argument appears to be a plain object.
4 */
5export default function isPlainObject(obj: any): boolean {
6  if (typeof obj !== 'object' || obj === null) return false
7
8  let proto = obj
9  while (Object.getPrototypeOf(proto) !== null) {
10    proto = Object.getPrototypeOf(proto)
11  }
12
13  return Object.getPrototypeOf(obj) === proto
14}
15