URI icon indicating copy to clipboard operation
URI copied to clipboard

fix npe

Open rdeshpande opened this issue 14 years ago • 2 comments

hey, just added a quick bugfix to check that module is defined - using this lib in a browser was throwing an error.

rdeshpande avatar May 16 '11 01:05 rdeshpande

I prefer to idiot-proof it, in case module is something like null:

try { module.exports = URI; } catch(ex) {}

...but maybe that's overkill?

mjb2010 avatar Dec 14 '11 11:12 mjb2010

Sure, that should work, but in node it seems to be okay either way?

foo ReferenceError: foo is not defined at [object Context]:1:1 at Interface. (repl.js:171:22) at Interface.emit (events.js:64:17) at Interface._onLine (readline.js:153:10) at Interface._line (readline.js:408:8) at Interface._ttyWrite (readline.js:585:14) at ReadStream. (readline.js:73:12) at ReadStream.emit (events.js:81:20) at ReadStream._emitKey (tty_posix.js:307:10) at ReadStream.onData (tty_posix.js:70:12) typeof(foo) 'undefined'

rdeshpande avatar Dec 17 '11 16:12 rdeshpande