isObject

Commons
stable

Type guard that returns true when the value is a plain (non-null, non-array) object. Excludes null and arrays which typeof incorrectly reports as "object".

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

obj
requis
any
The value to test. null returns false even though typeof null === "object". Arrays also return false.

API

Valeur de retour

La valeur retournée par cet util.

true and narrows the type to object when the value is a non-null, non-array object; false otherwise.

Usage

Exemples

Extraits de code prêts à coller.

Distinguishing plain objects from other types

typescript