Adding support for number types
This commit is contained in:
parent
dac2d326a0
commit
5964e27e05
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user