Viewing File: /home/ubuntu/voice-assistant-frontend/node_modules/@reduxjs/toolkit/src/isPlainObject.ts

/**
 * Returns true if the passed value is "plain" object, i.e. an object whose
 * prototype is the root `Object.prototype`. This includes objects created
 * using object literals, but not for instance for class instances.
 *
 * @param {any} value The value to inspect.
 * @returns {boolean} True if the argument appears to be a plain object.
 *
 * @public
 */
export default function isPlainObject(value: unknown): value is object {
  if (typeof value !== 'object' || value === null) return false

  let proto = Object.getPrototypeOf(value)
  if (proto === null) return true

  let baseProto = proto
  while (Object.getPrototypeOf(baseProto) !== null) {
    baseProto = Object.getPrototypeOf(baseProto)
  }

  return proto === baseProto
}
Back to Directory File Manager