* Parse separated city and state strings into a full * location if both are valid and non-null. * * @param {string} city The city where the book was published. * @param {string} state The state where the book was published. * @returns The full location string.
(city, state)
| 50 | * @returns The full location string. |
| 51 | */ |
| 52 | function parseLocation(city, state) { |
| 53 | if (!city || !state) { |
| 54 | return null; |
| 55 | } |
| 56 | |
| 57 | if (city.length === 0 || state.length === 0) { |
| 58 | return null; |
| 59 | } |
| 60 | |
| 61 | return `${city}, ${state}`; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Search for book details into the CBL database. |