@technobuddha/library
Version:
A large library of useful functions
19 lines (18 loc) • 519 B
text/typescript
/**
* Determines whether the provided value is a non-null object.
* @param value - The value to check.
* @returns `true` if the value is an object and not `null`; otherwise, `false`.
* @group Object
* @category Type Guards
* @example
* ```typescript
* isObject({}); // true
* isObject([]); // true
* isObject(null); // false
* isObject(42); // false
* isObject('hello'); // false
* ```
*/
export function isObject(value: unknown): value is object {
return typeof value === 'object' && value !== null;
}