* Parse the Open Library publish date into a proper year number. * * @param {string} publishDate The Open Library publish date. * @returns A parsed year as a number if it matches
(publishDate)
| 40 | * @returns A parsed year as a number if it matches |
| 41 | */ |
| 42 | function parseYear(publishDate) { |
| 43 | const match = publishDate && publishDate.match(/\d{4}/)[0]; |
| 44 | |
| 45 | return match ? parseInt(match, 10) : null; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Search for book details into the Open Library database. |
no outgoing calls
no test coverage detected