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

Function parseYear

services/isbn/openLibrary.js:42–46  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

40 * @returns A parsed year as a number if it matches
41 */
42function 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.

Callers 1

searchInOpenLibraryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected