Checks if a value is object-like.
null
and its typeof
is equal to 'object'
.const isObjectLike = val => val !== null && typeof val === 'object';
isObjectLike({}); // true
isObjectLike([1, 2, 3]); // true
isObjectLike(x => x); // false
isObjectLike(null); // false
JavaScript, Type
Checks if the a value is an empty object/collection, has no enumerable properties or is any type that is not considered a collection.
JavaScript, Type
Checks if an object looks like a Promise
.
JavaScript, Type
Checks if the passed value is an object or not.