Checks if the given value is plain Object (opens in a new tab).
Syntax
import { isObj } from '@opentf/std';
isObj(obj: unknown): boolean;
Examples
isObj(); //=> false
isObj(undefined); //=> false
isObj(null); //=> false
isObj(true); //=> false
isObj(false); //=> false
isObj(0); //=> false
isObj(1n); //=> false
isObj(''); //=> false
isObj([]); //=> false
isObj(() => {}); //=> false
isObj(Symbol); //=> false
isObj(Symbol('Sym')); //=> false
isObj(Math); //=> false
isObj(Math.min); //=> false
isObj(Error); //=> false
isObj(new Error()); //=> false
function fun(x) {
return x;
}
isObj(fun); //=> false
isObj(fun()); //=> false
isObj(new fun(1)); //=> false
isObj(Map); //=> false
isObj(new Map()); //=> false
isObj(Set); //=> false
isObj(new Set()); //=> false
isObj(/./); //=> false
class Person {
constructor(name) {
this.name = name;
}
}
isObj(new Person('x')) //=> false
isObj({}); //=> true
isObj({ a: 1 }); //=> true
isObj(new Object()); //=> true
isObj(Object.create(null)); //=> true