Path : /proc/thread-self/root/home/vishqocm/vjmedia.in/wp-content/plugins/coblocks/src/utils/
File Upload :
Current File : //proc/thread-self/root/home/vishqocm/vjmedia.in/wp-content/plugins/coblocks/src/utils/helper.js

/**
 * External dependencies
 */
import pick from 'lodash/pick';
import get from 'lodash/get';

// Set dim ratio.
export function overlayToClass( ratio ) {
	return ( ratio === 0 || ratio === 50 ) ?
		null :
		'has-background-overlay-' + ( 10 * Math.round( ratio / 10 ) );
}

// Pick image media attributes.
export const pickRelevantMediaFiles = ( image ) => {
	const imageProps = pick( image, [ 'alt', 'id', 'link', 'caption', 'imgLink' ] );
	imageProps.url = get( image, [ 'sizes', 'large', 'url' ] ) || get( image, [ 'media_details', 'sizes', 'large', 'source_url' ] ) || image.url;
	return imageProps;
};

// Define accepted media for gallery blocks.
export const ALLOWED_GALLERY_MEDIA_TYPES = [ 'image' ];