Function isPOJSObject

Checks and returns true if value is a POJSO Object (Plain Old JS Object), such as object literal {} or object created by Object.create() etc, but NOT instances (eg new MyClass()).

  • Unlike z.isRealObject(), it does not return true for instances created by new Xxx or for Array or Function or new String() etc.

  • Unlike lodash _.isPlainObject(Object.create({})) === false, isPOJSObject() returns true for Object.create({}) and Object.create(null) etc.

  • Don't even mention typeof or _.isObject() - it returns true for too many things, almost all refs like Array, Function etc!

  • Parameters

    • value: unknown

      any value

    Returns value is Record<string | symbol, any>

    true if the value is a POJSO object