Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
optometrists
/
cache
/
cache
/
cache
/
cache
/
cache
/
cache
/
cache
/
.wp-cli
/
wp-content
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
assets
/
js
/
base
/
components
/
cart-checkout
/
payment-method-icons
:
utils.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * For an array of icons, normalize into objects and remove duplicates. * * @param {Array} icons Array of icon objects or string based ids. */ export const normalizeIconConfig = ( icons ) => { const normalizedIcons = {}; icons.forEach( ( raw ) => { let icon = {}; if ( typeof raw === 'string' ) { icon = { id: raw, alt: raw, src: null, }; } if ( typeof raw === 'object' ) { icon = { id: raw.id || '', alt: raw.alt || '', src: raw.src || null, }; } if ( icon.id && ! normalizedIcons[ icon.id ] ) { normalizedIcons[ icon.id ] = icon; } } ); return Object.values( normalizedIcons ); };