Skip to content

Instantly share code, notes, and snippets.

@maca134
Created March 21, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maca134/747090b3ad52d8d75b73 to your computer and use it in GitHub Desktop.
Save maca134/747090b3ad52d8d75b73 to your computer and use it in GitHub Desktop.
var async = require('async');
findMatches.prototype.find = function(checkhash, complete) {
var self = this;
var matches = [];
async.eachLimit(hashes, 5, function (hash, next) {
if (hamming(checkhash, hash.hash) < 10) {
console.log('emiiting match');
self.emit('found-match', hash);
matches.push(hash);
}
async.nextTick(function(){
next();
});
}, function (err) {
complete(err, matches);
});
};
finder.find(msg, function (err, matches) {
console.log(err, matches);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment