diff options
Diffstat (limited to 'lib/backbone')
-rw-r--r-- | lib/backbone/glossary.js | 7 | ||||
-rw-r--r-- | lib/backbone/summary.js | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/backbone/glossary.js b/lib/backbone/glossary.js index b25d7c7..0f5e567 100644 --- a/lib/backbone/glossary.js +++ b/lib/backbone/glossary.js @@ -7,7 +7,7 @@ A glossary entry is represented by a name and a short description An unique id for the entry is generated using its name */ function GlossaryEntry(name, description) { - if (!(this instanceof Glossary)) return new Glossary(); + if (!(this instanceof GlossaryEntry)) return new GlossaryEntry(name, description); this.name = name; this.description = description; @@ -54,4 +54,9 @@ Glossary.prototype.get = function(id) { }); }; +// Return false if glossary has entries (and exists) +Glossary.prototype.isEmpty = function(id) { + return _.size(this.entries) === 0; +}; + module.exports = Glossary; diff --git a/lib/backbone/summary.js b/lib/backbone/summary.js index 7eb6e0c..96815a6 100644 --- a/lib/backbone/summary.js +++ b/lib/backbone/summary.js @@ -1,8 +1,14 @@ +var util = require('util'); +var BackboneFile = require('./file'); + var Article = require('./article'); function Summary() { - if (!(this instanceof Summary)) return new Summary(); + BackboneFile.apply(this, arguments); + + this.articles = []; } +util.inherits(Summary, BackboneFile); Summary.prototype.type = 'summary'; |