Extend Book.getLanguageBook

This commit is contained in:
Soreine
2016-05-11 17:54:26 +02:00
parent b97d1c7796
commit 7892259fe6
+10 -6
View File
@@ -176,14 +176,18 @@ Book.prototype.isLanguageBook = function() {
};
/**
Return a languages book
Returns the book for a language.
Returns itself if matches the language itself.
@param {String} language
@return {Book}
@param {String} lang Language ID
@return {Book | Null} Null if no such language
*/
Book.prototype.getLanguageBook = function(language) {
var books = this.getBooks();
return books.get(language);
Book.prototype.getLanguageBook = function(lang) {
if (this.getLanguage() === lang) {
return this;
} else {
return this.getBooks().get(lang) || null;
}
};
/**