Documentation and Modularized

Added documentation to duo.js and modularized the code for entry into
npm or use in node_modules