another approach to get this library working in node.js

This is an alternate approach to PR #6 .