diff options
Diffstat (limited to 'lib/models/languages.js')
-rw-r--r-- | lib/models/languages.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/models/languages.js b/lib/models/languages.js new file mode 100644 index 0000000..c64857f --- /dev/null +++ b/lib/models/languages.js @@ -0,0 +1,37 @@ +var Immutable = require('immutable'); + +var File = require('./file'); + +var Languages = Immutable.Record({ + file: File(), + list: Immutable.OrderedMap() +}); + +Languages.prototype.getFile = function() { + return this.get('file'); +}; + +Languages.prototype.getList = function() { + return this.get('list'); +}; + +/** + Get default languages + + @return {Language} +*/ +Languages.prototype.getDefaultLanguage = function() { + return this.getList().first(); +}; + +/** + Get a language by its ID + + @param {String} lang + @return {Language} +*/ +Languages.prototype.getLanguage = function(lang) { + return this.getList().get(lang); +}; + +module.exports = Languages; |