Namespace: Utilities

Utilities

Members

(static, constant) exports.genre2Labels :Genre

Dictionary of genres and their associated labels
Type:
Source:

(static, constant) exports.labels2Genre :Label

Dictionary of labels and their associated genres
Type:
Source:

Methods

(static) addToPrefs(book)

This function adds a book to a user's preferred books on Firestore.
Parameters:
Name Type Description
book Object The book to add.
Source:

(static) addToReading(book)

This function adds a book to a user's reading list on Firestore.
Parameters:
Name Type Description
book Object The book to add.
Source:

(static) getBooksFromGenres(genres, numOfBooksopt)

This function gets books for given genres
Parameters:
Name Type Attributes Default Description
genres Array The genres for which books are to be got
numOfBooks number <optional>
1 The number of books to return
Source:

(static) getBooksFromGenres(genre, numOfBooksopt)

This function gets books for a given genre
Parameters:
Name Type Attributes Default Description
genre string The genre for which books are to be got
numOfBooks number <optional>
1 The number of books to return
Source:

(static) getGenres() → {Array.<string>}

This function gets the user's preferred genres from Firestore.
Source:
Returns:
A list of genres.
Type
Array.<string>

(static) getReadingBooks() → {Array.<Object>}

This function retrieves a user's reading list from Firestore.
Source:
Returns:
The user's reading list.
Type
Array.<Object>

(static) removeFromReading(book)

This function removes a book from a user's reading list on Firestore.
Parameters:
Name Type Description
book Object The book to remove.
Source:

(static) searchBookOnGoogle(bookToSearch, verbose) → {Object}

This function searches for a given book using the Google Books API and returns a book object.
Parameters:
Name Type Description
bookToSearch Object The book to search for
Properties
Name Type Description
title string The target book title
author string The target book author
verbose boolean Whether to log the found book
Source:
Returns:
The first result from the Google Books API
Type
Object

(static) shuffle(array)

This function shuffles an array
Parameters:
Name Type Description
array Array The array to be shuffled
Source: