Last active
March 21, 2016 19:04
-
-
Save barrycarey/4172015b6dfd5dd57dd7 to your computer and use it in GitHub Desktop.
Something
This file contains 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
// This can take a long time to run. It emits each result as it finds it. | |
findMatches.prototype.find = function(hash) { | |
console.log('Searching for hash: ' + hash); | |
for (var i=0; i < hashes.length; i++) { | |
if (hamming(hash, hashes[i].hash) < 10) { | |
console.log('emiiting match'); | |
this.emit('found-match', hashes[i]); | |
} | |
} | |
}; | |
finder.find(msg) // This is hanging the server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment