MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / parsePrice

Function parsePrice

services/isbn/mercadoEditorial.js:34–47  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

32 * @returns The price object.
33 */
34function 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.

Callers 1

searchInMercadoEditorialFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected