summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSoreine <nicolas@gitbook.com>2016-05-12 14:08:29 +0200
committerSoreine <nicolas@gitbook.com>2016-05-12 14:08:29 +0200
commit61956e0646aef52d1060aff4b200c7dbbcf82f0d (patch)
tree2cfcf3e7f9aa092b74c88579ff5727ddf5e4567c /lib
parent7892259fe64a39a3a2cc3caedeb7ca8c3396dd56 (diff)
downloadgitbook-61956e0646aef52d1060aff4b200c7dbbcf82f0d.zip
gitbook-61956e0646aef52d1060aff4b200c7dbbcf82f0d.tar.gz
gitbook-61956e0646aef52d1060aff4b200c7dbbcf82f0d.tar.bz2
Revert "Extend Book.getLanguageBook"
This reverts commit 7892259fe64a39a3a2cc3caedeb7ca8c3396dd56.
Diffstat (limited to 'lib')
-rw-r--r--lib/models/book.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/models/book.js b/lib/models/book.js
index 0a4a41a..2a97f78 100644
--- a/lib/models/book.js
+++ b/lib/models/book.js
@@ -176,18 +176,14 @@ Book.prototype.isLanguageBook = function() {
};
/**
- Returns the book for a language.
- Returns itself if matches the language itself.
+ Return a languages book
- @param {String} lang Language ID
- @return {Book | Null} Null if no such language
+ @param {String} language
+ @return {Book}
*/
-Book.prototype.getLanguageBook = function(lang) {
- if (this.getLanguage() === lang) {
- return this;
- } else {
- return this.getBooks().get(lang) || null;
- }
+Book.prototype.getLanguageBook = function(language) {
+ var books = this.getBooks();
+ return books.get(language);
};
/**