Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
primogenial
/
wp-content
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
assets
/
js
/
base
/
utils
:
get-icons-from-payment-methods.ts
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * External dependencies */ import type { PaymentMethods, PaymentMethodIcons as PaymentMethodIconsType, } from '@woocommerce/type-defs/payments'; /** * Get the provider icons from payment methods data. * * @param {PaymentMethods} paymentMethods Payment Method data * @return {PaymentMethodIconsType} Payment Method icons data. */ export const getIconsFromPaymentMethods = ( paymentMethods: PaymentMethods ): PaymentMethodIconsType => { return Object.values( paymentMethods ).reduce( ( acc, paymentMethod ) => { if ( paymentMethod.icons !== null ) { acc = acc.concat( paymentMethod.icons ); } return acc; }, [] as PaymentMethodIconsType ); };