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.
Also why is this function exported