Comparing version 1.0.0 to 1.1.0
@@ -16,5 +16,5 @@ var FNV = require('fnv').FNV | ||
var Filter = function (data) { | ||
this.buffer = new Buffer(size) | ||
this.buffer.fill(0) | ||
var Filter = function (databuf) { | ||
this.buffer = new Buffer(databuf || size) | ||
if (!databuf) this.buffer.fill(0) | ||
} | ||
@@ -52,4 +52,7 @@ | ||
empty: function () { | ||
return new Filter(size) | ||
return new Filter() | ||
}, | ||
fromBuffer: function (buf) { | ||
return new Filter(buf) | ||
}, | ||
merge: function (a, b) { | ||
@@ -56,0 +59,0 @@ var filter = new Filter() |
{ | ||
"name": "blomma", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Bloom filters yet again", | ||
@@ -5,0 +5,0 @@ "main": "blomma.js", |
@@ -131,2 +131,14 @@ 'use strict' | ||
}) | ||
describe('fromBuffer', function () { | ||
it('should have made filter from buffer', function () { | ||
var f1 = bloom.empty() | ||
f1.add('oho') | ||
f1.add('aha') | ||
var f2 = bloom.fromBuffer(f1.buffer) | ||
assert(f2.has('oho')) | ||
assert(f2.has('aha')) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7167
182