* Parse separated currency and price into a price object * if both are valid and non-null. * * @param {string} currency The currency of the book price. * @param {string} price The price of the book. * @returns The price object.
(currency, price)
| 32 | * @returns The price object. |
| 33 | */ |
| 34 | function parsePrice(currency, price) { |
| 35 | if (!currency || !price) { |
| 36 | return null; |
| 37 | } |
| 38 | |
| 39 | if (currency.length === 0 || price.length === 0) { |
| 40 | return null; |
| 41 | } |
| 42 | |
| 43 | return { |
| 44 | currency, |
| 45 | amount: parseFloat(price), |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Search for book details into the Mercado Editorial database. |
no outgoing calls
no test coverage detected