diff options
Diffstat (limited to 'lib/backbone/glossary.js')
-rw-r--r-- | lib/backbone/glossary.js | 7 |
1 files changed, 6 insertions, 1 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; |