/**
* @module isEmptyObject
* @description Determines if the specified obj is an empty object.
*
* @since 1.0.0
*
* @param {object} obj The object to be tested.
*
* @return {boolean} Returns true if the specified obj is an object and is empty. Returns false otherwise.
*
* @example
* import { isEmptyObject } from "@gravityforms/utils";
*
* function Example() {
* const obj = { prop: 'val' };
* const isEmpty = isEmptyObject( obj );
* }
*
*/
export default function( obj ) {
for ( const prop in obj ) {
if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
return false;
}
}
return JSON.stringify( obj ) === JSON.stringify( {} );
}