Fix Node.js, Narwhal and RingoJS detection

In Node.js, Narwhal and RIngoJS, `exports` is not found on the `global`
object, but instead is part of the module scope.