Fix node npm module

Hi Arthur, 

- This small patch fixes your module for node
- I've also ported a part of your test suite to assert it works in a node.js environment (chai + mocha, couldnt get jasmine to talk )
- Run the tests with `npm install && npm test`