reverse amd/node detection so this can work in the browser with both requirejs and browserify