HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/lacalita/wp-content/plugins/rey-core/inc/gutenberg/src/utils/block-helpers.js
/**
 * WordPress dependencies
 */
import { registerBlockCollection, getCategories } from '@wordpress/blocks';

/**
 * Determine if the block attributes are empty.
 *
 * @param {Object} attributes The block attributes to check.
 * @return {boolean} The empty state of the attributes passed.
 */
export const hasEmptyAttributes = ( attributes ) => {
	return ! Object.entries( attributes )
		.map( ( [ , value ] ) => {
			if ( typeof value === 'string' ) {
				value = value.trim();
			}

			if ( value instanceof Array ) {
				value = value.length;
			}

			if ( value instanceof Object ) {
				value = Object.entries( value ).length;
			}

			return !! value;
		} )
		.filter( ( value ) => value === true ).length;
};

/**
 * Return bool depending on registerBlockCollection compatibility.
 *
 * @return {boolean} Value to indicate function support.
 */
export const supportsCollections = () => {
	if ( typeof registerBlockCollection === 'function' ) {
		return true;
	}
	return false;
};

/**
 * Check for which category to assign.
 *
 * @return {boolean} Value to indicate function support.
 */
export const hasFormattingCategory = getCategories().some( function( category ) {
	return category.slug === 'formatting';
} );