The value to check.
true
if the check passes, false
otherwise.
This function will return true
for an array
. If you
do not want this behavior, use isObject instead.
isObjectLoose({}) // true
isObjectLoose([]) // true
isPlainObject(null) // false
const value: string | { foo: string }
if (isObjectLoose(value)) {
value // type: { foo: string }
} else {
value // type: string
}
// warning: arrays will pass
const value: { bar: string } | string[] | null
if (isObjectLoose(value)) {
value // type: { bar: string } | string[]
} else {
value // type: null
}
Generated using TypeDoc
Checks if a value is
typeof object
and notnull
.