Created
March 21, 2016 19:15
-
-
Save maca134/747090b3ad52d8d75b73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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