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

Function parsePrice

services/isbn/googleBooks.js:32–41  ·  view source on GitHub ↗

* Parse the Google Books price format into a proper object. * * @param {object} saleInfo The Google Books price. * @returns The price object.

(saleInfo)

Source from the content-addressed store, hash-verified

30 * @returns The price object.
31 */
32function parsePrice(saleInfo) {
33 if (!saleInfo || saleInfo.saleability === 'NOT_FOR_SALE') {
34 return null;
35 }
36
37 return {
38 currency: saleInfo.retailPrice.currencyCode,
39 amount: saleInfo.retailPrice.amount,
40 };
41}
42
43/**
44 * Search for book details into the Google Books database.

Callers 1

searchInGoogleBooksFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected