Skip to content

isObject

The isObject function checks if the provided value is an object (excluding null).

Syntax

typescript
isObject(value: any): value is object;

Parameters

ParameterTypeDescription
valueanyValue to be checked

Returns

TypeDescription
booleanTrue if it is an object (not null)

Examples

typescript
isObject({}); // => true
isObject([]); // => true
isObject(null); // => false

Notes

  • Arrays and functions are also considered objects in JavaScript.

References

Released under the MIT License.