How to calculate CUSIP checksum digit

Here is my JS implementation of the algorithm which can be found on wikipedia.