UNPKG

392 BJavaScriptView Raw
1/**
2 * @param {any} obj The object to inspect.
3 * @returns {boolean} True if the argument appears to be a plain object.
4 */
5export default function isPlainObject(obj) {
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}