tguard-js
    Preparing search index...

    Function isPlainObject

    • Determines whether the provided value is a plain object.

      Parameters

      • o: unknown

        The value to be checked.

      Returns o is Record<PropertyKey, unknown>

      true if the value is a plain object, otherwise false.

      A plain object is an object created using:

      • Object literal ({})
      • new Object()
      • Object.create(null)

      This function returns false for arrays, class instances, built-in objects, and special object types.

      This function only narrows the top-level type and does not validate nested properties.

      Value Result
      {} true
      new Object() true
      Object.create(null) true
      [] false
      new Date() false
      new Map() false
      class A {}; new A() false
      null false
      undefined false

      1.0