data_is-object.js

/**
 * @module isObject
 * @description Test if an item is a JavaScript object (i.e. not an array or any other type ).
 *
 * @since 1.0.0
 *
 * @param {*} item The item to be tested.
 *
 * @return {boolean} Returns true if the specified item is a JavaScript object. Returns false otherwise.
 *
 * @example
 * import { isObject } from "@gravityforms/utils";
 *
 * function Example() {
 *   const someObject = { 'prop' : 'val' };
 * 	 const isObject = isObject( someObject );
 * }
 *
 */
export default function isObject( item ) {
	return ( item && typeof item === 'object' && ! Array.isArray( item ) ) ? true : false;
}