Check if a value is an object
JavaScript version
const isObject = (v) => v !== null && typeof v === 'object';
TypeScript version
const isObject = (v: any): boolean => v !== null && typeof v === 'object';
Examples
isObject(null); // false
isObject('hello world'); // false
isObject({}); // true
isObject([]); // true