From 5964e27e056033f173537103ff5c218c5553379c Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 8 Jul 2012 22:17:52 -0700 Subject: [PATCH 1/2] Adding support for number types --- bloomfilter.js | 4 ++-- test/bloomfilter-test.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bloomfilter.js b/bloomfilter.js index eb81cbd..109c0fe 100644 --- a/bloomfilter.js +++ b/bloomfilter.js @@ -42,7 +42,7 @@ }; BloomFilter.prototype.add = function(v) { - var l = this.locations(v), + var l = this.locations(v.toString()), i = -1, k = this.k, buckets = this.buckets; @@ -50,7 +50,7 @@ }; BloomFilter.prototype.test = function(v) { - var l = this.locations(v), + var l = this.locations(v.toString()), i = -1, k = this.k, b, diff --git a/test/bloomfilter-test.js b/test/bloomfilter-test.js index 73971fe..03c0e45 100644 --- a/test/bloomfilter-test.js +++ b/test/bloomfilter-test.js @@ -42,7 +42,13 @@ suite.addBatch({ var f = new BloomFilter(20, 10); f.add("abc"); assert.equal(f.test("wtf"), false); - } + }, + "works with integer types": function() { + var f = new BloomFilter(1000, 4); + f.add(1); + assert.equal(f.test(1), true); + assert.equal(f.test(2), false); + } } }); From 21a5ac699b83e2d086d87e873ee7eb8050192de4 Mon Sep 17 00:00:00 2001 From: Jason Davies Date: Mon, 9 Jul 2012 10:56:47 +0100 Subject: [PATCH 2/2] Add node_modules to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules