From 98aeab6a8a8a5cc705391ef7076c761b80d57889 Mon Sep 17 00:00:00 2001 From: Nate Good Date: Sun, 16 Aug 2015 22:03:59 -0400 Subject: [PATCH] Increment nElement Looks like nElement never gets incremented, yet it is used in the `isEmpty` function. As a result, `isEmpty` would always return true. --- lib/natural/util/bag.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/natural/util/bag.js b/lib/natural/util/bag.js index c5ddb3c25..360d90e24 100644 --- a/lib/natural/util/bag.js +++ b/lib/natural/util/bag.js @@ -28,6 +28,7 @@ function Bag() { Bag.prototype.add = function(element) { this.dictionary.push(element); + this.nElement++; return this; };