10 examples of 'javascript check if variable is object' in JavaScript

Every line of 'javascript check if variable is object' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
25function isObject(variable, message) {
26 expect(variable).not.to.be.instanceOf(Array, message);
27}
1export function isObject(value) {
2 const type = typeof value;
3 return value != null && (type == 'object' || type == 'function');
4}
70export function isObject (object) {
71 return object !== null && typeof object === 'object'
72}
32function isObject(value) {
33 // avoid a V8 bug in Chrome 19-20
34 // https://code.google.com/p/v8/issues/detail?id=2291
35 var type = typeof value;
36 return type == 'function' || (value && type == 'object') || false;
37}
81_is_object(candidate={}){
82 return (typeof candidate === 'object')
83}
78function isObject(value){
79 return value && typeof value == 'object' && value.constructor.name == 'Object';
80}
4export default function isobject(value) {
5 var type = typeof value;
6 return !!value && (type == "object" || type == "function");
7}
10export function isObject (value) {
11 return typeof value === 'object' &&
12 value !== null &&
13 !Array.isArray(value) &&
14 value.toString() === '[object Object]'
15}
100function isObject(value) {
101 if (!value) {
102 return false;
103 }
104 return typeof value === "object" || typeof value === "function";
105}
23function isFunction(variable) {
24 return typeof variable === "function";
25}

Related snippets