This is in JavaScript now

JavaScript rewrite of the original script, because we hate ourselves and decided to write this in node.
No ldap because we'd probably need some node package for it and I'm not that deep.
Should be throw new Error(""). See: https://www.joyent.com/developers/node/design/errors