https://github.com/mitallast/diablo-js
The code's not commented very heavily, but it's pretty readable nonetheless.