Notice: A more complete and robust library that does metaphones and much more: https://github.com/NaturalNode/natural
This is almost a 1:1 copy of the PHP implementation by Stephen Woodbridge. It is very likely that it has bugs. If you find any, please send me a patch or fork and send a pull request as I'm unsure how much I'll maintain this myself.