@@ -44,9 +44,7 @@ export const getAmountFromMoneyNode = (moneyNode?: Node) => {
4444
4545export const getCurrencyFromMoneyNode = ( moneyNode : Node ) : CurrencyType => {
4646 const currencyNode = moneyNode . path ( [ 'currency' ] ) ;
47- const currency = ! currencyNode . isMissing ( ) ?
48- currencyNode . asString ( ) . trim ( ) :
49- DEFAULT_MONEY_NODE . path ( [ 'currency' ] ) . asString ( ) ;
47+ const currency = ! currencyNode . isMissing ( ) ? currencyNode . asString ( ) . trim ( ) : DEFAULT_MONEY_NODE . path ( [ 'currency' ] ) . asString ( ) ;
5048
5149 return currency as CurrencyType ;
5250} ;
@@ -60,7 +58,7 @@ export const getMoneyString = (moneyNode: Node, args: string[], ctx: Context): s
6058 if ( useCLDRMode ( ctx ) ) {
6159 const amount = getAmountFromMoneyNode ( moneyNode ) ;
6260 const currencyCode = getCurrencyFromMoneyNode ( moneyNode ) ;
63-
61+
6462 return ctx . cldr ?. Numbers . formatCurrency ( amount , currencyCode , currencyOptions ( args ) ) ?? '' ;
6563 } else {
6664 const legacyAmount = getLegacyPriceFromMoneyNode ( moneyNode ) ;
@@ -78,15 +76,13 @@ export const getSubscriptionMoneyFromFirstPricingOptions = (pricingOptions: Node
7876
7977 const node = pricingOptions . get ( 0 ) ;
8078
81- return isTruthy ( node . path ( [ 'onSale' ] ) )
82- ? node . path ( [ 'salePriceMoney' ] )
83- : node . path ( [ 'priceMoney' ] ) ;
79+ return isTruthy ( node . path ( [ 'onSale' ] ) ) ? node . path ( [ 'salePriceMoney' ] ) : node . path ( [ 'priceMoney' ] ) ;
8480} ;
8581
8682export const getPricingOptionsAmongLowestVariant = ( item : Node ) : Node | null => {
8783 const productType = getProductType ( item ) ;
8884 const structuredContent = item . path ( [ 'structuredContent' ] ) ;
89-
85+
9086 switch ( productType ) {
9187 case ProductType . PHYSICAL :
9288 case ProductType . SERVICE :
@@ -96,9 +92,7 @@ export const getPricingOptionsAmongLowestVariant = (item: Node): Node | null =>
9692 }
9793
9894 const first = variants . get ( 0 ) ;
99- const moneyNode = isTruthy ( first . path ( [ 'onSale' ] ) )
100- ? first . path ( [ 'salePriceMoney' ] )
101- : first . path ( [ 'priceMoney' ] ) ;
95+ const moneyNode = isTruthy ( first . path ( [ 'onSale' ] ) ) ? first . path ( [ 'salePriceMoney' ] ) : first . path ( [ 'priceMoney' ] ) ;
10296
10397 let pricingOptions = first . path ( [ 'pricingOptions' ] ) ;
10498 let price = getAmountFromMoneyNode ( moneyNode ) ;
0 commit comments