Skip to content

isObject

Detects if a variable is a javascript Object.

True for plain objects (and other non-array object instances such as a Date), false for arrays, null, primitives, functions, and the DOM globals window, document, and elements. assign relies on this to decide what to merge recursively and what to copy as a value.

import {isObject} from "@d3plus/dom";

isObject({});
isObject({a: 1});
isObject(new Date());
isObject([]);
isObject(null);
isObject("text");
isObject(() => 1);
isObject(document.body);
isObject(window);

Parameters

import {isObject} from "@d3plus/dom";
itemrequiredunknown

The value to test.